Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help Defining a range using variables for column
Hi I need to define the range below, column B needs to be replaced with
variable CurCol. How do I do this? Set rngSource = .Range(.Range("B21"), .Range("B21").End(xlDown)) Thanks, Mike |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help Defining a range using variables for column
dim strCol as String
strCol = "B" Set rngSource = .Range(.cells(21, strcol), .cells(21, strcol).End(xlDown)) I would be more inclined to use xlUp from the bottom of the range in case there are any blanks but that is up to you... dim strCol as String strCol = "B" Set rngSource = .Range(.cells(21, strcol), .cells(.rows.count, strcol).End(xlUp)) -- HTH... Jim Thomlinson "mikeb" wrote: Hi I need to define the range below, column B needs to be replaced with variable CurCol. How do I do this? Set rngSource = .Range(.Range("B21"), .Range("B21").End(xlDown)) Thanks, Mike |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help Defining a range using variables for column
Sub sistence()
Dim s As String Dim CurCol As String CurCol = "A" s = CurCol & "21" With ActiveSheet Set rngSource = .Range(.Range(s), .Range(s).End(xlDown)) End With End Sub -- Gary''s Student - gsnu200850 "mikeb" wrote: Hi I need to define the range below, column B needs to be replaced with variable CurCol. How do I do this? Set rngSource = .Range(.Range("B21"), .Range("B21").End(xlDown)) Thanks, Mike |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Defining a Range using Variables | Excel Discussion (Misc queries) | |||
Defining Named Range for Lastrow in a specific column | Excel Discussion (Misc queries) | |||
help with defining column only from range of cells | Excel Programming | |||
VBA defining variables | Excel Discussion (Misc queries) | |||
defining an event procedure (lostfocus) that works on a column range | Excel Programming |