VBA Go to next empty cell in row

mribadeneira

New Member
Joined
Apr 10, 2013
Messages
7
I am struggling to write the code to go to the next empty cell in a row. I have the code:
Code:
Sheets("Resultados").Select
Range("A3").Select
Range(Selection.End(xlToRight)).Select
ActiveCell.Offset(0, 1).Select
 ActiveCell.Value = BP1
however this is not working. My program loops several times each time adding a value to the end of the row.
Please help if you can
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
You can combine all that in to one command, try just:

Sheets("Resultados").Range("A3").End(xlToRight).Offset(0,1) = BP1
 
Upvote 0
Thanks ChrisM, but i am getting an Error: Application-definer or object-defined error.
And my problem also is that when cell B3 is empty when the program starts, the .End(xlToRight) command instead of going to B3 goes to the last column on Excel.
 
Upvote 0
You can test for A3 being empty first:

Code:
If Sheets("Resultados").Range("A3") = "" Then
   Sheets("Resultados").Range("A3") = BP1
Else
   Sheets("Resultados").Range("A3").End(xlToRight).Offset(0,1) = BP1
End If
 
Upvote 0

Forum statistics

Threads
1,215,463
Messages
6,124,962
Members
449,200
Latest member
indiansth

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