PDA

View Full Version : [SOLVED:] Finding the next empty cell in a row



olivetwist
07-06-2015, 06:24 AM
I am running a macro to import excel files and need help.

I am needing to find code to set a variable "Y" to the column number of the next empty cell in a row.

For example: if row 6 has data from column 3 to 50 but column 32 is blank then set y = 32.

olivetwist
07-06-2015, 06:41 AM
I figured it out:

Y = ws.Range("C6").End(xlToRight).Column

I was using xlRight instead of xlToRight which is why it kept erroring out.

donaldsims
08-19-2015, 06:29 AM
Thanks for sharing the solution.

BrynjulfRasm
09-16-2015, 05:35 AM
Thanks for the useful information