select next empty cell and go 2 cells right

RAJESH1960

Banned for repeated rules violations
Joined
Mar 26, 2020
Messages
2,313
Office Version
  1. 2019
Platform
  1. Windows
I am able to select the next empty cell with the help of this VBA.
Range("F1").End(xlDown).Offset(1).Select
But I want to go to the second empty cell in row F1 and then move 1 cell right in the same row, i.e. G column.
What is the right code.?
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Not sure why you're using .end(xlDown) - wasn't neccesary

VBA Code:
Range("F1").Offset(2, 1).Select
(offset 2 positive rows, 1 positive column)

to step back wards, use negative offset values; so from from G3 to F1 you could use:

VBA Code:
ActiveCell.Offset(-2, -1).Select
 
Upvote 0
Not sure why you're using .end(xlDown) - wasn't neccesary

VBA Code:
Range("F1").Offset(2, 1).Select
(offset 2 positive rows, 1 positive column)

to step back wards, use negative offset values; so from from G3 to F1 you could use:

VBA Code:
ActiveCell.Offset(-2, -1).Select
G column has a lot of empty cells in the middle. But F column has empty cell in the end. Your code is selecting the empty cell in G3 where as it has to select G:141 as F:140 is the next empty cell.
 

Attachments

  • Untitled.png
    Untitled.png
    22.2 KB · Views: 11
Upvote 0
VBA Code:
Cells(Rows.count, "G").End(xlUp).Select
or
VBA Code:
Columns("G").Find("*", , xlValues, , xlByRows, xlPrevious).Select
 
Upvote 0
VBA Code:
Cells(Rows.count, "G").End(xlUp).Select
or
VBA Code:
Columns("G").Find("*", , xlValues, , xlByRows, xlPrevious).Select
Even that code works. Thanks Mark.
 
Upvote 0

Forum statistics

Threads
1,214,789
Messages
6,121,590
Members
449,039
Latest member
Arbind kumar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top