VBA Excel select the first empty column
SolvedJerome -
Once again, I am calling for your help. I have created a macro using the automatic recorder to write in the first empty column of row 1.
So I selected column C1 and pressed "ctrl + right arrow" and then right arrow again.
Range("C1").Select
Selection.End(xlToRight).Select
Range("R1").Select
However, as I read my code, it selects the last cell, so far no problem, but then it selects cell R1, which is probably my first empty column, but week after week the selection won't necessarily be cell R1; it could be S1, T1, U1, AA1, etc.
Do you know how to write this code?
Once again, thank you for your help,
Best regards,
Jérôme
29 réponses
- 1
- 2
Simply add 1 in the first line of code ☺
y = Range("C1").End(xlToRight).Column + 1
Best regards
Via
--
"Imagination is more important than knowledge." A. Einstein
Sorry to bother you once again, but I have two questions regarding my macro.
When I execute the code, it works very well but I always have to include the full code:
y = Range("C1").End(xlToRight).Column
Cells(1,y).Select
Because if I don't add y = Range("C1").End(xlToRight).Column before the code Cells(1,y).Select each time, it writes over the same column each time, replacing the last command. Is this normal? I'm asking for my understanding because it doesn't bother me at all to write the full code each time. Also, making my y a Dim as Byte is pointless, isn't it?
My other question is about the next steps, as I’m looking for the last cell to add a VLOOKUP, except that in my macro created with the recorder, it specifies the cell while thanks to the above code it refers to the last filled column. So in the recorded formula, I had my formula starting from the cell below the one I just created and the formula correctly referenced column Q, for example. But now, if it’s another column than Q, I get an error message 1004 The AutoFill method of the Range class has failed.
Here’s the base code
Range("Q1").Select
ActiveCell.FormulaR1C1 = "Current list present"
Range("Q2").Select
ActiveCell.FormulaR1C1 = "Yes"
Range("Q2").Select
Selection.AutoFill Destination:=Range("Q2:Q11606"
But now, I might not be in column Q but R/S/T/AA, etc. So there’s no problem to send it down (thanks to you by the way), but if the code
y = Range("C1").End(xlToRight).Column
Cells(1,y).Select
Returns me to column AB, for example, the cell below must write the formula IFERROR(VLOOKUP and fill down to the last filled row, but I don’t know the column as it’s an unknown linked to the previous command and in this case I would need the code below to no longer select Q but AB. Is that possible?
I’m really not very clear, here are the two examples of codes
Code we are working on and where the Destination:=Range("? " & derligne) is unknown
'Variable to select the last column to the right
y = Range("n1").End(xlToRight).Column + 1
Cells(1, y).Select
ActiveCell.FormulaR1C1 = "Current list present"
ActiveCell.Offset(1, 0).Select
ActiveCell.FormulaR1C1 = "Yes"
'Variable derligne = Sends the formula down to the last filled row of column D
derligne = Range("D" & Rows.Count).End(xlUp).Row
'Send Yes down to the last row
Selection.AutoFill Destination:=Range("Q2:Q" & derligne)
Code with the recorder
Range("Q1").Select
ActiveCell.FormulaR1C1 = "Current list present"
Range("Q2").Select
ActiveCell.FormulaR1C1 = "Yes"
Range("Q2").Select
Selection.AutoFill Destination:=Range("Q2:Q11606")
Range("Q2:Q11606").Select
Thank you for your help,
Have a good evening
Best regards
It is true that it is not clear
Why do you mention adding the code each time?
If it is at the beginning of the macro, each time you run the macro, the last empty column is determined by y = Range("C1").End(xlToRight).Column + 1
Then you select this cell with Cells(1,y).Select
You can write in it: Cells(1,y) = "text to write"
If you want to then write in the empty cell to the right of this one within the same macro, there is no need to search again for the last empty column, you just take the cell Cells(1,y+1)
As for the second point, your last line of code should be
Selection.AutoFill Destination:=Range(Cells(1, y), Cells(derligne, y))
Best regards
Via
--
"Imagination is more important than knowledge." A. Einstein
Hello Via,
Yes, I realized it while rereading :-D, but you understood me. Hoping to be clearer, it's for my understanding because beyond achieving it thanks to you, I want to understand and improve myself :-)
Actually, I thought that the code y = Range("C1").End(xlToRight).Column + 1 associated with Cells(1,y).Select would take me each time to the new empty column and select it, no matter how many times I repeated the code in the macro. However, when I tested it, it always selected the same cell and modified the name instead of putting it in the next one.
For example,
y = Range("C1").End(xlToRight).Column + 1
Cells(1, y).Select
'In this example, let's imagine that it selects column E1, which is the first empty one
Cells(1, y) = "text to write"
Cells(1, y).Select
'This time, in the continuation, it should have selected F1, which is now the first empty one, yet it selects E1 and replaces "text to write" with "text to write 2" with the following command
Cells(1, y) = "text to write 2"
Cells(1, y).Select
'This time, in the continuation, it should have selected G1, which is now the first empty one, yet it selects E1 and replaces "text to write 2" with "text to write 3" with the following command
Cells(1, y) = "text to write 3"
But this is not good, but by executing the same code, but by adding the code y = Range("C1").End(xlToRight).Column + 1 each time in front, it selected the correct cell.
Example
y = Range("C1").End(xlToRight).Column + 1
Cells(1, y).Select
'In this example, let's imagine that it selects column E1, which is the first empty one
Cells(1, y) = "text to write"
y = Range("C1").End(xlToRight).Column + 1
Cells(1, y).Select
'In this example, it selects F1
Cells(1, y) = "text to write 2"
y = Range("C1").End(xlToRight).Column + 1
Cells(1, y).Select
'In this example, it selects G1
Cells(1, y) = "text to write 3"
And with your feedback, I can simply use this code which also works:
y = Range("C1").End(xlToRight).Column + 1
Cells(1, y).Select
Cells(1, y) = "text to write"
Cells(1, y + 1).Select
Cells(1, y + 1) = "text to write 2"
Cells(1, y + 2).Select
Cells(1, y + 2) = "text to write 3"
For the second point, a big thank you once again :-)
However, when I executed it, it didn't work. I received an error message 1004: The AutoFill method of the Range class has failed.
Do you know what I executed incorrectly?
'Variable derligne = Send the formula down to the last filled row of column D
derligne = Range("D" & Rows.Count).End(xlUp).Row
'Send the Yes down to the last row
Selection.AutoFill Destination:=Range(Cells(1, y), Cells(derligne, y))
Thank you for your help,
Sincerely
Jérôme
Re
References in RC are made relative to the cell where the formula is entered
You should be positioned in column R, so N is the 4th column back (-4), M is the 5th back (-5), and T is the 2nd column forward (2)
But you can also use the usual references in VBA like this
ActiveCell.Formula = _
"=IFERROR(VLOOKUP(Range("N2"),SHEETS("IEP S-1").RANGE("M:T"),4,0),""Non"")"
Best regards
Via
Hello Via,
Thank you very much for these clarifications. However, when I use the following references, the line displays in red and I can't see what the issue is?
ActiveCell.Formula = _
"=IFERROR(VLOOKUP(Range(""N2""),SHEETS(""IEP S-1"").RANGE(""M:T""),4,0),""Non"")"
Thank you for your help,
Best regards
Jérôme
The problem is that I had written nonsense, I got my wires crossed between the Sheets and Range instructions to put in a macro line but which do not appear in the formula for a cell!!
The correct writing is: ActiveCell.Formula = "=IFERROR(VLOOKUP(N2,'IEP S-1'!M:T,4,0),""non"")"
Best regards
Via
Hello Via,
I’m reaching out once again. I created a pivot table with my source being my IEP sheet. As you taught me, to get the last row, I created a DIM LIEP that I added to the range of my pivot table ("IEP!$A$1:$S$" & LIEP, Version:=6).CreatePivotTable TableDestination:= _). However, now I also need the same command extending to the right.
Here’s the command from the recorder:
Range("A1").Select
' seems unnecessary Application.CutCopyMode = False
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"IEP!R1C2:R11500C21", Version:=6).CreatePivotTable TableDestination:= _
"TCD!R1C1", TableName:="Pivot Table1", DefaultVersion:=6
'
I made unsuccessful attempts. The variable doesn’t seem to be blocking, but is it correct? And especially, it gets stuck when I wrote:
"IEP!$B:CIEP" & LIEP, Version:=6).CreatePivotTable TableDestination
'
'Variable for last filled row in the IEP sheet column B
DLIEP = Sheets("IEP").Columns(2).Find("*", , , , xlByColumns, xlPrevious).Row
'variable for last filled column
CIEP = Sheets("IEP").Columns(2).Find("*", , , , xlByColumns, xlPrevious).Column
Range("A1").Select
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"IEP!$B:CIEP" & LIEP, Version:=6).CreatePivotTable TableDestination:= _
"TCD!R1C1", TableName:="Pivot Table1", DefaultVersion:=6
Thank you for your help.
Have a great evening,
Jérôme
Good evening Jérôme
1) Write your code like this:
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _ "IEP!R1C2:R" & DLIEP & "C" & CIEP, Version:=6).CreatePivotTable TableDestination:= _ "TCD!R1C1", TableName:="PivotTable1", DefaultVersion:=6
2) For the last column, the code is:
CIEP = Sheets("IEP").Rows(2).Find("*", , , , xlByColumns, xlPrevious).Column Best regards
Via
Hello Via,
'
Great, thank you very much. While doing this, I have a few little questions. Indeed, a bit higher up in my macro, I remove duplicates.
'
'Select column N (13th column) between B and Q and remove duplicates
Columns("N:N").Select
'Variable for the last filled row of the IEP sheet in column B
DLIEP = Sheets("IEP").Columns(2).Find("*", , , , xlByColumns, xlPrevious).Row
'Remove duplicates up to the last row
ActiveSheet.Range("$B$1:$Q$" & DLIEP).RemoveDuplicates Columns:=13, Header:= _
xlYes
'
However, as a result when it selects my range for my PivotTable, it takes the range up to the last deleted row, thus including empty rows.
For example: I started with 11605 rows and after removing duplicates I have 11500. Yet, in the PivotTable range, it searches for data up to row 11605 (IEP!$B$1:$U$11605). Would you know why and how to ensure it only takes up to 11500?
'
I also have three questions for clarification regarding the command "IEP!R1C2:R" & DLIEP & "C" & CIEP
R1C2 = what does it mean?
R = Why R, what does it correspond to?
C = Why "C", what does it correspond to?
'
Thank you very much for your help
Best regards
Jérôme
Hello again Via,
I have another question, I have an Excel page on which I need to have 5 PivotTables. I need to place them in different locations on the page.
The 1st one is located in A1 until its end.
Cells(1, 1).Select
'PivotTable1
'Variable last filled row of the "PivotTable" sheet for the 1st PivotTable in column A
DLTCD = Sheets("PivotTable").Columns(1).Find("*", , , , xlByColumns, xlPrevious).Row
The second one is below by 9 rows.
' PivotTable2
HTCD2 = Cells(DLTCD + 9, 1).Select
'Variable last filled column of the "PivotTable" sheet for PivotTable1
CTCD = Sheets("PivotTable").Rows(1).Find("*", , , , xlByColumns, xlPrevious).Column
The third one is to the right of the first one (3 columns over), so E.
‘PivotTable3
'Select the third empty cell to the right after PivotTable1
HTCD3 = Cells(1, CTCD + 3).Select
And the fourth one is supposed to be 5 rows below PivotTable3, but the code below does not work. Do you know why?
'Variable last filled row of the "PivotTable" sheet for PivotTable3 in column E
DLTCD3 = Sheets("PivotTable").Columns(5).Find("*", , , , xlByColumns, xlPrevious).Row
'Select the fifth empty cell below PivotTable3
‘PivotTable4
HTCD4 = Cells(DLTCD3 + 5, 1).Select
Thank you for your help,
Best regards
Jérôme
Hello Jérôme
HTCD4 = Cells(DLTCD3 + 5, 1).Select Selects the 1st column so there's an error because it's pasting on an existing table
It should rather be HTCD4 = Cells(DLTCD3 + 5,5).Select
Then the rows
Selection.End(xlToRight).Select Range(Selection, Selection.End(xlDown)).Select Range(Selection, Selection.End(xlDown)).Select Range(Selection, Selection.End(xlDown)).Select Range(Selection, Selection.End(xlToRight)).Select Application.CutCopyMode = False Selection.Copy Range("E1").Select Selection.End(xlDown).Select Selection.End(xlDown).Select Selection.End(xlDown).Select Range("E27").Select I don't see what they correspond to and I think they should be removed
Other errors occur later in the macro which I think come from a recording that you adjusted
If I were you, I would delete the entire end of the macro after this last PT and after making sure everything works up to that point, I would calmly pick up from there (recording necessary operations if needed) step by step to finalize a macro that will work
Good luck
Best regards
Via
Re
It's indeed the form of the first formula that is correct, but it’s nonsense because the ESG variable is used sometimes for the row and sometimes for the column.
Selection.AutoFill Destination:=Range(Cells(ESG, 5), Cells(derligneSuiviG, ESG))
Please correct your formula like this:
Selection.AutoFill Destination:=Range(Cells(ESG, 5), Cells(derligneSuiviG, 5))
Best regards,
Via
Hello
Apparently R29C9 refers to row 29 of column 9, I don't know what that corresponds to in your file, but you can modify the references with variables instead of the row and column
for example with LTCD for the 1st row of your pivot table and CTCD for its column :
ActiveCell.FormulaR1C1 = "=GETPIVOTDATA(""IEP - Venue/Passage""," & "TCD!R" & LTCD & "C" & CTCD & " )"
Best regards
Via
CTCD5 = Sheets("TCD").Rows(1).Find("*", , , , xlByColumns, xlPrevious).Column gives you the last column, but you need the 1st of TCD5 and this column is probably always the same so you can likely hard-code the number in the macro
for example ActiveCell.FormulaR1C1 = "=GETPIVOTDATA(""IEP - Venue/Passage""," & "TCD!R" & HTCD5 & "C9" & " )" if it's column 9
why can’t I use HTCD5 for both the column and the row
because the column is not the same as the row!! the variable HTCD5 should give 29 while the column is 9
Hello
After the instruction Cells(1, y + 2) = "text to write 3" we are positioned in column y + 2 so Selection.AutoFill Destination:=Range(Cells(1, y), Cells(derligne, y)) returns an error since you indicate in this second instruction y as the starting column
Either you actually want to fill column y and you need to return to that column first with a Select.Cells(1,y) or you want to fill column y + 2 and you need to code the AutoFill accordingly Selection.AutoFill Destination:=Range(Cells(1, y + 2), Cells(derligne, y + 2))
Best regards
Via
Hello Via,
Thank you so much for your help. Okay, I think I understand (sorry, I need to fully grasp the VBA mechanics, which I haven't yet mastered), but basically for my command Selection.AutoFill Destination:=Range(Cells(1, y), Cells(derligne, y)), it concerns the row below y in this case.
Here is the code that was causing issues:
'Variable to select the last column to the right
y = Range("n1").End(xlToRight).Column + 1
Cells(1, y).Select
ActiveCell.FormulaR1C1 = "Present current list"
'Select the cell below the above command and enter "Yes"
ActiveCell.Offset(1, 0).Select
ActiveCell.FormulaR1C1 = "Yes"
'Variable derligne = Sends the formula down to the last filled row of column D
derligne = Range("D" & Rows.Count).End(xlUp).Row
'Send the Yes down to the last row
Selection.AutoFill Destination:=Range(Cells(1, y), Cells(derligne, y))
And so here's the code I need to write?
'Variable to select the last column to the right
y = Range("n1").End(xlToRight).Column + 1
Cells(1, y).Select
ActiveCell.FormulaR1C1 = "Present current list"
'Select the cell below the above command and enter "Yes"
ActiveCell.Offset(1, 0).Select
ActiveCell.FormulaR1C1 = "Yes"
'Variable derligne = Sends the formula down to the last filled row of column D
derligne = Range("D" & Rows.Count).End(xlUp).Row
'Send the Yes down to the last row
Selection.AutoFill Destination:=Range(Cells(2, y), Cells(derligne, y))
Is that correct? After testing it seems to work.
While I'm at it, I have a new question. When creating the formula below (With and Without the $), I easily understand the logic of my formula in spreadsheet as the columns are identified, but in VBA, I don't grasp the logic to determine the cells "RC[-4]" which corresponds to N2 or "C[-5]:C[2]" which corresponds to M:T. However, with the $ I think I understand that M=13th column and T the 20th.
Without the $
=IFERROR(VLOOKUP(N2,'IEP S-1'!M:T,4,0),"Non")
ActiveCell.FormulaR1C1 = _
"=IFERROR(VLOOKUP(RC[-4],'IEP S-1'!C[-5]:C[2],4,0),""Non"")"
With the $
=IFERROR(VLOOKUP(N2,'IEP S-1'!$M:$T,4,0),"Non")
ActiveCell.FormulaR1C1 = _
"=IFERROR(VLOOKUP(RC[-4],'IEP S-1'!C13:C20,4,0),""Non"")"
Thank you very much!
Best regards,
Jérôme
Hi,
1) If you use the same DLIEP variable for the Pivot Table, since this variable contains the number of the last line before duplicate removal, it is normal that it always takes all the rows. After removing duplicates and before the Pivot Table, you need to recalculate the last non-empty row with
DLIEP = Sheets("IEP").Columns(2).Find("*", , , , xlByColumns, xlPrevious).Row
2) R1C2 = ROW1 COLUMN2, which means row 1 column 2, or again B1
3) Regarding the placement of your Pivot Tables, your instructions seem correct, but I can't tell you what's wrong without your complete file with its macro
What's not working? Is the placement incorrect? Is the calculation of the last non-empty line not being done? ..
What value is indicated for DLTCD3 when you hover over it in the code after stopping?
Best regards
Via
Re,
Thanks +++, well even if you know what you're talking about, I confirm that for point 1 it works well :-) thanks
'
Thank you for the explanation of point 2.
'
For point 3
PIVOT1 = A1:B30
PIVOT2 = A39:B68
PIVOT3= E1:F12
PIVOT4= In error, it selects A17
What is not working? Is the placement not correct? Instead of selecting E+5 lines below PIVOT3, it selects A17
Is the calculation of the last non-empty line not happening? .. Clearly not since it doesn't seem to go under PIVOT3
Thank you for your help,
Regards
Jérôme
Hello Via,
So strong and thank you for your help. In fact, at first, through the recorder, I created the TCD1, then I copied/pasted the TCD1 to create my TCD2 and added what I wanted. For the TCD3, it was the same, I copied/pasted the TCD1 and created my TCD3.
However, for TCD4, I copied the TCD3. The thing is, TCD3 has two filters and to select it via the recorder, I selected cell E1 (Name of filter1) and then I did (Shift + Ctrl + Down arrow) once, which selected the second filter. I did (Shift + Ctrl + Down arrow) again, which took me to the top of my TCD3, and I did it one last time to reach the bottom. I then did it to the right (Shift + Ctrl + Right arrow), which allowed me to select the entire TCD3 and I was able to copy it.
Here is the code with the recorder
Range("E1").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Application.CutCopyMode = False
Selection.Copy
Range("E1").Select
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Range("E27").Select
ActiveSheet.Paste
The problem is that in VBA, I couldn't manage to select TCD3 to copy it.
I tried the following commands, but it didn't work. Do you know how I can copy my TCD3 that has two filters?
Range("HTCD3").currentregion.Select ==> which only selects the two filters
and
HTCD3 = Cells(1, CTCD + 3).End(xlUp).End(xlToRight).Select which is incorrect
Thanks again for your help,
Best regards
Jérôme
I don't know !!
But when you can't take the right, you take the left
If I were you, I would keep copying the Pivot Table 1 in my macro and paste it in the right place with the now corrected instruction
Then, by going back to the table and saving, I would make all the necessary manipulations to adapt it according to what I want in terms of filters and so on, and I would then integrate the recording into my macro
No worries, and frankly, a big thank you for all your help and the speed of your replies.
I will indeed always start from my TCD1 :-)
Thanks again
Best regards
Jérôme
Hello Via,
Sorry to bother you again, but I need your help once more. In my global tracking tab, I need to pull a formula (column E) from the last filled cell to the one below. I wanted to find the first empty row (where my "new" formula should be)
'''Variable to select the first empty row (global tracking tab) column E
ESG = Range("E3").End(xlDown).Row +1
Then I wanted to send it down to the last filled cell in column D (which has exactly one more filled cell)
'''Variable derligneSuiviG = Sends the formula down to the last filled row of column D
derligneSuiviG = Range("D" & Rows.Count).End(xlUp).Row
Next, I selected the desired cell
Cells(ESG, 5).Select
And I tried to send my cell with the proposals below but it didn't work.
Selection.AutoFill Destination:=Range(Cells(ESG, 5), Cells(derligneSuiviG, ESG))
Selection.AutoFill Destination:=Range(Cells(derligneSuiviG, 5))
Selection.AutoFill Destination:=Range(Cells(derligneSuiviG, ESG))
I also tried this
ESG = Range("E3").End(xlDown).Row
Cells(ESG + 1, 5).Select
Selection.AutoFill Destination:=Range(Cells(ESG, derligneSuiviG))
And the same, it didn't work. Do you know what I did wrong?
Thank you for your help,
Sincerely
Jérôme
Hello Via,
Thank you very much, I searched and searched, trying not to bother you, but I ultimately had no choice. It works perfectly. I understand the principle a bit, but I'm still struggling and always end up getting stuck on one element.
I’d like to take the opportunity to ask you another question if you don’t mind? I have a command that fetches the results from TCD1/TCD3/TCD5 and reports them in my global tracking table.
The recorder wrote me this command: ActiveCell.FormulaR1C1 = "=GETPIVOTDATA(""IEP - Venue/Passage"",TCD!R29C9)"
It works very well! My only concern is that the TCDs are variable depending on the results and can be +/- long, and if it were to be longer than what is calculated and started for example at line 35, it would return an error. Do you think it is possible to replace TDC!R29C9 with my HTCD5 which corresponds to the first cell of TCD5?
Thank you for your help,
Best regards,
Jérôme
Re,
Yes, that's it, line 29 of column 9 corresponds to my TCD5.
So, the only variable I have from TCD5 is this one
'Variable High TCD5 - Select the second empty cell to the right of TCD 4
HTCD5 = Cells(DLTCD3 + 9, 9).Select
I tried to use this variable for the columns (Exactly the same as for TCD1), but I don't understand what element I need to modify to adapt it to TCD5
'''variable last filled column of the TCD sheet for TCD5
CTCD5 = Sheets("TCD").Rows(1).Find("*", , , , xlByColumns, xlPrevious).Column
and finish with this command that did not work:
ActiveCell.FormulaR1C1 = "=GETPIVOTDATA(""IEP - Venue/Passage""," & "TCD!R" & HTCD5 & "C" & CTCD5 & " )"
And a second question, I need to enter today's date + text next to it.
I made the formula
ActiveCell.FormulaR1C1 = "=TODAY()& "" test"""
To copy/paste as values, but the date appears as code 44759 even when I format it as date. Do you know how to do that?
Thank you for your help,
Sincerely
Jérôme
As I understand it, the cell in row 29 and column 9 should be the first one at the top left of the pivot table.
HTCD5 is not a row number for you, it is the selection of a cell.
On the other hand, CTCD5 does return a column number but it is not the first one of TCD5.
You need to use formulas to determine the first row and the first column of your TCD5.
HTCD5 = ..... and CTCD5 = .....
Then, to check that the returned values are correct, for testing purposes (you will remove this line afterward), you put MsgBox HTCD5 & " " & CTCD5.
When you have determined the correct values, the GETPIVOTDATA... formula should work.
Regards
Via
- 1
- 2
Once again, a big thank you for your help. While trying the code, I realize that I expressed myself poorly.
With this code, I end up on the last filled column of C1.
y= Range("C1").End(xlToRight).Column
Cells(1,y).Select
ActiveCell.FormulaR1C1 = "Present previous base"
However, the next command is to write "present previous base", but it writes it in the last filled column and replaces the current title with this command.
y= Range("C1").End(xlToRight).Column
Cells(1,y).Select
ActiveCell.FormulaR1C1 = "Present previous base"
What I would like is to write it just next to it in the first empty column. I thought I could combine it with the command to move the cursor to the right? But maybe you have a better command?
ActiveCell.Offset(0, 1).Select
Thanks again for your help,
Best Regards