selecting different columns

  • Thread starter Thread starter Bill Roberts
  • Start date Start date
B

Bill Roberts

I want to do a select case that picks a specific column based on another,
independent variable. Something like:
select case colno
case1
if a=1 then colno="C" (Select column C)
if a=2 then colno="M", etc.
Then I want to do a range select, such as range(2,colno).select, or
range("colno,2").select, or something similar. I have tried all the
combinations and quotes I can think of but no luck. Is there a correct
format to use something other than range("C2").select to select that cell?
TIA Bill Roberts
 
dim IndVar as long
dim ColNo as long

indvar = 12
select case indvar
case is = 1: colno = 3
case is = 2: colno =
case is = 13: colno = 2
case else
colno = 0 'not used indicator
end select

if colno = 0 then
msgbox "not today, buddy!"
else
activesheet.cells(2,colno).select
end if
 
Thank you Dave. Appreciate the quick response. I figured out that
cells(rowno,colno).select also does the job. I'm still learning the
difference between the cells().select and the range().select commands.
 
Back
Top