I know how to get the row number of the cursor in a spreadhseet (Activecell.Row), but how do I get the cursor location in a list object so that I can then insert a new row for the user at that point?
BTW, I am using tables (ListObjects) because when a row is inserted, all of my formulas are automatically inserted.
I have a button in my worksheet. When clicked on I want to change the text in this button so far so good. I have however a problem how to return to the cell that was active, the moment I clicked the button. so far I have the following code
is there a way for a udf to return the cell's original value instead of an error.
ie. the UDF in the cell returned a value from a database. now if i move the database and reopen this sheet, excel will try to recalculate and if it doesn't find the database it will return an error. instead of that i just want excel to return whatever was in the cell, before it had to be recalculated.
How do I write a VB Script to take the user back to where they came from.
Example:
User is on Sheet 1 and clicks a macro that takes him to Sheet 10. I need a macro that is on Sheet 10 that takes the user back to Sheet 1. BUT if the User is on Sheet 5 and clicks on a macro that take him to Sheet 10 I need that same macro on Sheet 10 to take him back to Sheet 5.
User selects 'go to page B' on page A. They look at an object then click the object to go back to page A. Once back on page A they need to check data on page B, but in the same general location as where they just looked. This is over simplified, but pretty much sums up what I need to do. The code I have now is below, but keeps sending me to the last selection on my current page.
Public Sub SaveLocation(ReturnToLoc As Boolean) Static WB As Workbook Static WS As Worksheet Static R As Range If ReturnToLoc = False Then Set WB = ActiveWorkbook Set WS = ActiveSheet Set R = Selection Else WB.Activate WS.Activate R.Select End If End Sub
Public Sub SetSaveLoc() SaveLocation (False) End Sub
Public Sub GetSaveLoc() SaveLocation (True) End Sub
I am working with a VBA userform and several textbox's, setting SetFocus and or TabIndex doesn't leave the box ready to accept input and there is no cursor shown to indicate it is ready to accept input.
I am trying to take a column of data located on one sheet and move into two different locations on another sheet. My range is from A1:A10. The below code works, but as it loops, it replaces G1 and H1 with the other values from the original range. Once the first pos and neg values are placed in G1 and H1 respectively, I want the next cells to be evaluated and placed in G2 and H2 etc. What am I missing here? How can I get it to stop pasting over itself?
Sub test() Dim bcell As Range For Each bcell In Range("a1:a10") If bcell > 0 Then bcell.Copy Destination:=Worksheets("Sheet2").Range("G1") Else: If bcell < 0 Then bcell.Copy Destination:=Worksheets("sheet2").Range("H1") End If Next bcell End Sub
We have a product plan, which we are trying to automate. To break it down we have a product number which will consist of several other components parts. In the product plan we are tying to automate showing which components are in constraint to the side of the complete part number. We've tried using VLOOKUP but it only ever returns the first value it finds, whereas we need to show all constrained parts. Have tried to break it down into ranges as per attached, but this is unreliable as the data is drawn from another source, and corrupts the ranges if re-imported or sorted.
I'm having trouble identifing a way to return a location for the position of the active cell. I've searched Excel help with "Position, location, return, activecell, etc." and I can't seem to figure this out. I know that it's possible, so that's why I'm on here!
...
Ok, say the active cell is currently "F1", and I need the location "F1" to identify the ROW to be used in a formula later, how would I go about that?
The current contents of cell "F1"' will be "REPLACE", but I need to change the words "REPLACE" in "F1" and other cells labeled "REPLACE" in column F to the following formula (where the "1" in "A1" is is the current row):
I have a value stored in variable A. I need to search one column for the location of that value and return the row value. there is no chance for a duplicate entry. Is a loop my only option, or is there a find command in VB?
Need a T/F formula that will return T if any 2 of the 3 values from previous row are double digits and the third digit is also from previous row. The 3 digits in the same row must have a zero.
Examples
668 T 806 995 T 509 995 F 519
******** ******************** ************************************************************************>Microsoft Excel - CASH 3 EVE COMBO GROUPS.xlsx___Running: 12.0 : OS = Windows XP (F)ile (E)dit (V)iew (I)nsert (O)ptions (T)ools (D)ata (W)indow (H)elp (A)boutA3=ABCDE302/06/09006T402/05/09016F502/04/09110T602/03/09610F702/02/09661T802/01/09160FSheet1 [HtmlMaker 2.42] To see the formula in the cells just click on the cells hyperlink or click the Name boxPLEASE DO NOT QUOTE THIS TABLE IMAGE ON SAME PAGE! OTHEWISE, ERROR OF JavaScript OCCUR.
How to write a VBA code so that it would calculate the date of the previous Friday and from there Return the date exactly 1 month before; on any given day.
For example... today is may 8th
So if I run the code the dates returned for last friday should be 05/02/2014 and 04/04/2014 should be returned AS the DATE exactly a month from 05/02/2014
how do i get the previous days working date in VBA, how can i get VBA to determine wether we are in the week, and how will i get it to know its a monday to retrieve fridays date?
I am applying data validation in my workbook. The data in ColS consist of:
ColS (Row2) X (Row3) Y (Row4) Y (Row5) Y (Row6) X
In ColT, I am to apply data validation: i.e. If in concerned row of ColS is having "X" value, then I am to show an error message. Else, values from A2:A5 should be shown in the as list and these should be accepted in ColT.
Windows 7, Excel 2007. a formula to find the next lowest sequential number within a group.
Here's an example data set, which represents transactions by date and category:
Col A is a user entered Date which will not be in chronological order (unfortunately a sort is not an option)Col B is a user entered CategoryCol C is a formula that gives the chronological sort order based on the date.
The formula in C2:C9 is =COUNT($A$2:$A$9)-(RANK(A2,$A$2:$A$9)+COUNTIF($A$2:A2,A2)-1)+1Col D is a formula to determine if the row is the first chronological transaction within the Category
The array formula in D2:D9 is =IF(MIN(IF($B$2:$B$9=B2,$C$2:$C$9))=C2,"Y","")
This might not be a necessary column, but can be used as a helperCol E is where I would like a formula to give the next lowest value in Col C for the Category in Col B (the order number in Col C for the previous transaction within the same category).
I have entered in the values that the formula should return in Col E in the table below
A B C D E
[Code]...
If the current line is the first transaction of the category, the formula should return the value in Col C for that line (so E2 would equal the value in C2, which is 2).
So the first part of the formula could be straightforward, using the helper column: =IF(D2="Y",C2,
Here's the tricky part: If it's not the first occurrence of the category, then it should return the value of Col C for previous transaction (or the next lowest number in Col C that is within the same category).
E3 would return 4, since the previous transaction for Category A was line 9 C3 = 6, and of all the values of Col C for Category A (2, 4, 6, 8), 4 is the next lowestE4 would return 6, since the previous transaction for Category A was line 3 C4 = 8, and of all the values of Col C for Category A (2, 4, 6, 8), 6 is the next lowestE5 would return 1, since it is the first transaction in Category BE6 would return 1, since the previous transaction for Category B was line 5 C6 = 5, and of all the values of Col C for Catebory B (1, 5, 7), 1 is the next lowestEtc.
I'm thinking I need an array formula to find the minimum value within the category, where that value is less than the value of Col C in the current line. Just not sure how to write that...
I need code for a search box function, that returns the information recorded in a cell for example, "Barcelona" or "London" etc), instead of the location of the cells.
I will need to narrow it down to search only the information in the following columns:
Sheet2 I2:J10932
I am totally new to VBA coding and have stumbled my way through a few things, but everything I have searched for so far has had at least one error when transposing to Excel.
see attached file. Need to find latest non blank value - in attached file it is highlighted in yellow. From there, want to summarise 26 weeks back so, in the attached file:
Row 2 would be finding 750 and summarised back 26 weeks from 30 sep 2012 Row 3 would be finding 2250 and summarised back 26 weeks from 2 dec 2012 Row 4 would be finding 5000 and summarised back 26 weeks from 4 nov 2012
I am trying to develop a spreadsheet that will calculate a cost based on a matrix. I am attaching a sample of the calculation created so far. The end result is in cell M13 and is highlighted in yellow. I kind of layed the formula out in a few different cells, so hopefully it would be easy to follow.
simplify this process with maybe another formula that I might not be aware of, or maybe show me how to get this done in VB code. I think VB code would be the correct way to go just not sure.
I'm talking about the little black box that appears anytime you put the mouse on a cell, or drag the mouse around a group of cells - mine doesn't show up. I can still edit the cell, but I have to guess about which cell I am on.
I try to move the cursor using the keyboard arrows it stays on the cell it is on and the whole spreadsheet page moves across the screen in the direction of the arrow. So how do I restore cursor movement to the arrows.
How do I make the cursor jump down to the next row. Example: once I entered value on H2, I would like the cursor jump down to A3 then once I reach H3, the cursor would jump down to A4 and so on.
For many projects I work on I use listviews in forms, this time I thought I'd try something different.
I've created a scrollable frame with dynamically added controls and have started creating their events in a class module.
Here is the problem I now face. If I create for example a label at design time I can click on the MouseIcon property and navigate to the "hand.cur" file I have.When dynamically creating the label control I have been able to reference to the file by using:
What I've now done is embed the file on a worksheet, but hat the correct syntax is to refer to it. I've come up with the following but it doesn't work:
I received this code from the board about a month ago. It works perfectly to highlight the row the cursor is currently in but, has one flaw. Once you place this code in the sheet module and the code initiates, it will "erase all other highlight colors" within your sheet. Is there a way to correct this problem?
Here is the code;
Private Sub Worksheet_SelectionChange(ByVal Target As Range) Cells.Interior.ColorIndex = xlNone
With Target.EntireRow.Interior .ColorIndex = 37 .Pattern = xlGray25 .PatternColorIndex = 24 End With End Sub