Select Range using variables

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to select a range from the active cell 16 rows down and a variable
number of columns to the left. I've named my variable "MyMonths", but I'm
not sure how to incorporate it into a range address.
 
Nevermind. I answered my own question.

ActiveCell.Range(Cells(1, 1), Cells(16, MyMonths)).Select
 
Define "variable number of columns to the left". Back to Column A or ??? If
Column A then...

dim rngTo Select as range
dim wks as worksheet

set wks = activesheet
set rngtoSelect = wks.range(activecell, .cells(activecell.row + 16, "A"))

rngtoselect.select
 
Activecell.Offset().MyMonths).Resize(16,MyMonths).Select

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
I thought I had it before, but only close.

It's working now. Thanks Bob and Jim.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top