Need to Select multiple cells based on counter

  • Thread starter Thread starter Skyron
  • Start date Start date
S

Skyron

Hey,

I'm having trouble finding how to make a selection of cells usin
integer values rather than text

i.e.
Range("A1:A5")

Is there a way to use Range with integer values?
I need to make selections of cells based on an integer counter in a VB
Script

Thanks!!
 
A couple of ways:

For only one column -

Range("A" & iFirstRow & ":A" & iLastRow)

where ifirstrow and ilastrow are the row range. Or-

Range(Cells(iFirstRow, iFirstCol), Cells(iLastRow, iLastCol))

to select from multiple contiguous rows and columns.
 
Range(Cells(1,1),Cells(5,1))

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
You can use Cells

Sub test()
Range(Cells(1, 1), Cells(5, 1)).Select
End Sub
 
I find it easier to use the Cells() object, something like

Cells(myrownumber, mycolumnnumber)
 

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