• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to select a range in a single Row by using two variables in VBA

Ali Asgar

New Member
Hi Friends,
I want to select a range in a single Row by using two variables. For Example if I want to select B9 to B88, I need to store 9 & 88 in variables. Any pointers would be a great help.

Thanks,
Ali
 

Hui

Excel Ninja
Staff member
Ali

Firstly, Welcome to the Chandoo.org Forums

Here are 3 ways

Code:
Sub Select_Cells()
Dim StartRow As Integer, EndRow As Integer
StartRow = 9
EndRow = 88

Range("B" & StartRow & ":B" & EndRow).Select
Range(Cells(StartRow, 3), Cells(EndRow, 3)).Select
Range("D" & StartRow).Resize(EndRow - StartRow, 1).Select

End Sub
 
Top