View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Get next empty Column?

Hi James,

To set a variable Rng to the first empty cell in row 1 on sheet2, try:

Dim Rng As Range
Const rw As Long = 1 '<<====== CHANGE
If IsEmpty(Cells(rw, 1)) Then
Set Rng = Cells(rw, 1)
Else
Set Rng = Cells(rw, Columns.Count). _
End(xlToLeft)(1, 2)
End If
MsgBox Rng.Address


Change the rw value to reflect the row that you use to test for an empty
column.


---
Regards,
Norman



"James" wrote in message
...
I want the button to copy from one sheet and each time I'd like it to place
the numbers in the next available column

Do I need to loop and check for emptiness?

Thanks