so i currently have a macro where i push a button on the spreadsheet and input a row number in the dialogue box that pops up, and then my macro produces a form with the row info. i want to update it so that i can input more than 1 row at time, using a dash (-) to indicate a series of rows, and a comma (,) to break these series or individual rows apart (exactly how it works when you specidfy which pages to print, for example).
now, i know i will need to include a for loop. do i need to change my variable to an array? what type of variable do i set it as? would this be correct:
this would work for separating by commas. i don't know how to deal with the dash (-). please bestow me with epic knowledge.
VBA Code:
Sub BT
Dim rows as Variant
rows = InputBox("Enter Row Number. Only 1 row please.")
'rest of code fills out form
End Sub
now, i know i will need to include a for loop. do i need to change my variable to an array? what type of variable do i set it as? would this be correct:
VBA Code:
Dim rows() as String
Dim var as Variant
rows() = InputBox("Enter Row Number. For multiple rows, you can include a range such as 1-10, or you can list the rows seperated by a comma, or do both.")
rows = split(rows, ",")
For Each var in rows
'rest of code fills out form
Next var
this would work for separating by commas. i don't know how to deal with the dash (-). please bestow me with epic knowledge.