1
Dim finishedStartRow As Long
Rows("finishedStartRow:finishedStartRow").Select

I'm trying to select the row 481805 using the finishedStartRow variable. I'm getting a type mismatch error because .Select can only handle Integers. Is there a workaround? Thanks!

Scott Craner
  • 148,073
  • 10
  • 49
  • 81
Gary Dorman
  • 375
  • 1
  • 5
  • 16

1 Answers1

2

The dim'med var should not be included in quotes.

Dim startStartRow As Long
Dim finishedStartRow As Long

startStartRow = 2
finishedStartRow = 481805

'all of these are valid for variations on selection¹
Rows(finishedStartRow).Select
Rows(finishedStartRow & ":" & finishedStartRow).Select
Rows(startStartRow & ":" & finishedStartRow).Select

¹ See How to avoid using Select in Excel VBA macros for more methods on getting away from relying on select and activate to accomplish your goals.

Community
  • 1
  • 1