Re: Get next empty Column?
From: Norman Jones (normanjones_at_whereforartthou.com)
Date: 09/17/04
- Next message: Alan Beban: "Re: Table Lookup (VLookup, Index, Match)"
- Previous message: Dave Peterson: "Re: Trouble Drawing shapes with macros in Excel"
- In reply to: Norman Jones: "Re: Get next empty Column?"
- Next in thread: James: "Re: Get next empty Column?"
- Reply: James: "Re: Get next empty Column?"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 17 Sep 2004 23:12:43 +0100
Hi James,
I omitted to qualify the code to refer to Sheet2:
Dim Rng As Range
Const rw As Long = 1 '<<====== CHANGE
With Sheets("Sheet2") '<<====== 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
End With
MsgBox Rng.Address
--- Regards, Norman "Norman Jones" <normanjones@whereforartthou.com> wrote in message news:OLu56AQnEHA.4004@TK2MSFTNGP10.phx.gbl... > 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" <j@j.net> wrote in message > news:eXZA1sPnEHA.3968@TK2MSFTNGP11.phx.gbl... >>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 >> >> > >
- Next message: Alan Beban: "Re: Table Lookup (VLookup, Index, Match)"
- Previous message: Dave Peterson: "Re: Trouble Drawing shapes with macros in Excel"
- In reply to: Norman Jones: "Re: Get next empty Column?"
- Next in thread: James: "Re: Get next empty Column?"
- Reply: James: "Re: Get next empty Column?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|