I am trying to find out if something is possible in Excel VBA. I would like to use a string or integer to modify/represent the name of a range object. Please note that I do not have a range stored in string format.
For example, I have the following range objects already set: rng1, rng2, rng3, etc.
I am looping through rows and want to change the associated range with each iteration, using either a string or integer. Below is a sample of the code (not working) I need help with.
Expand|Select|Wrap|Line Numbers
- Dim loImmobile As ListObject
- Dim rowImmobile As ListRow
- Dim shtImmobile As Worksheet
- Dim rngPlace As Range
- Dim intCount As Integer
- Set shtImmobile = Worksheets("shtImmobile")
- Set loImmobile = shtImmobile.ListObjects("tblImmobile")
- intCount = 5
- For Each rowImmobile In loImmobile.ListRows
- rngPlace = RandCell(Rng(intCount))
- 'Do things with rngPlace
- intCount = intCount + 1
- Next rowImmobile
Expand|Select|Wrap|Line Numbers
- rngPlace = RandCell(Rng(intCount))