how to select a range by row and column

jamiguel77

Active Member
Joined
Feb 14, 2006
Messages
378
Office Version
  1. 2016
  2. 2010
  3. 2007
Platform
  1. Windows
  2. Web
hi i try:


MyRange = NewSheet.Range(NewSheet.Cells(wrenHojaNuevaTop, wyi), NewSheet.Cells(wrenHojaNuevaTop- 1, wyi))

wrenHojaNuevaTop=2
wrenHojaNuevaTop=3

but not work, note NewSheet Exist... isnt the problem....


thanks any advice?
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Set MyRange =

Also, what value has been assigned to the variable NewSheet ?
 
Last edited:
Upvote 0
Any what value are you assigning to your variable wyi?
 
Upvote 0
To answer the question in the post title "how to select a range by row and column"

Here are some codes you may find useful:

Select by rows:
Code:
Sub ByRow()Range("1:10").Select
End Sub

Select by columns:
Code:
Sub ByCol()Range("A:E").Select
End Sub

Both:
Code:
Sub Both()Range("A1:E10").Select
End Sub

You can even use variables

By rows:
Code:
Sub ByRow()
Row1 = 1
Row2 = 10
Range(Row1 & ":" & Row2).Select
End Sub

By Columns:
Code:
Sub ByCol()
Col1 = "A"
Col2 = "E"
Range(Col1 & ":" & Col2).Select
End Sub

Or both:
Code:
Sub Both()
    Row1 = 1
    Row2 = 10
    Col1 = "A"
    Col2 = "E"
        Adrs = Col1 & Row1 & ":" & Col2 & Row2
Range(Adrs).Select
End Sub
 
Upvote 0
hi thanks for answer..... the Set solved my problem.....

thanks
 
Upvote 0

Forum statistics

Threads
1,215,419
Messages
6,124,796
Members
449,189
Latest member
kristinh

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top