Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Variable for column selection

Hi,

I use the script;
Range("D" & Rows.Count).End(xlUp).Offset(1).Select
...to check for the last row in a given column.

but I need to change the column D to a variable. I tried different ways to
write that without success. Appreciate if someone can give a hint!

Thanks!
--
Mats W.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Variable for column selection

One way:

Dim colvar As String
colvar = "D"
Range(colvar & Rows.Count).End(xlUp).Offset(1).Select

"Mats W." wrote:

Hi,

I use the script;
Range("D" & Rows.Count).End(xlUp).Offset(1).Select
..to check for the last row in a given column.

but I need to change the column D to a variable. I tried different ways to
write that without success. Appreciate if someone can give a hint!

Thanks!
--
Mats W.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Variable for column selection

Dim iCol As Long


Cells(Rows.Count, iCol).End(xlUp).Offset(1).Select

--
HTH

Bob Phillips

"Mats W." wrote in message
...
Hi,

I use the script;
Range("D" & Rows.Count).End(xlUp).Offset(1).Select
..to check for the last row in a given column.

but I need to change the column D to a variable. I tried different ways to
write that without success. Appreciate if someone can give a hint!

Thanks!
--
Mats W.



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
How do I include an all tab in a pivot variable selection Userx Excel Discussion (Misc queries) 1 September 26th 05 01:03 PM
Sum cells based on a row variable and seperate column variable CheeseHeadTransplant Excel Worksheet Functions 10 September 23rd 05 06:59 PM
Assign a variable from a Listbox selection. Jako[_20_] Excel Programming 1 June 13th 04 10:25 AM
Assign a variable from a Listbox selection. Leo Heuser[_3_] Excel Programming 0 June 13th 04 09:03 AM
Assign a variable from a Listbox selection. Jako[_21_] Excel Programming 0 June 13th 04 08:29 AM


All times are GMT +1. The time now is 06:37 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"