ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need to Select multiple cells based on counter (https://www.excelbanter.com/excel-programming/298191-need-select-multiple-cells-based-counter.html)

Skyron[_2_]

Need to Select multiple cells based on counter
 
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!!

--
Message posted from http://www.ExcelForum.com


kkknie[_92_]

Need to Select multiple cells based on counter
 
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.



--
Message posted from http://www.ExcelForum.com


Ron de Bruin

Need to Select multiple cells based on counter
 
You can use Cells

Sub test()
Range(Cells(1, 1), Cells(5, 1)).Select
End Sub



--
Regards Ron de Bruin
http://www.rondebruin.nl


"Skyron " wrote in message ...
Hey,

I'm having trouble finding how to make a selection of cells using
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 VBA
Script

Thanks!!!


---
Message posted from http://www.ExcelForum.com/




Juan Pablo González

Need to Select multiple cells based on counter
 
I find it easier to use the Cells() object, something like

Cells(myrownumber, mycolumnnumber)

--
Regards

Juan Pablo González

"Skyron " wrote in message
...
Hey,

I'm having trouble finding how to make a selection of cells using
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 VBA
Script

Thanks!!!


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 02:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com