Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Defining a Range using Variables Billyruben Excel Discussion (Misc queries) 3 December 2nd 08 06:31 PM
Defining Named Range for Lastrow in a specific column Barb Reinhardt Excel Discussion (Misc queries) 5 May 9th 07 08:55 PM
help with defining column only from range of cells KJL Excel Programming 1 January 9th 07 02:05 AM
VBA defining variables Jeff Excel Discussion (Misc queries) 2 November 3rd 05 11:33 PM
defining an event procedure (lostfocus) that works on a column range juhlott Excel Programming 1 July 8th 04 08:26 PM


All times are GMT +1. The time now is 01:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"