Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
 
Posts: n/a
Default VBA Code for selecting row

Ok I know how to write the code for selecting a row. Here is an example:
Rows("8:27").Select

What if instead of the number i want to use vairables such as:
Rows("x:y").Select

Can anyone tell me how to do this? If you can please email


  #2   Report Post  
Ron de Bruin
 
Posts: n/a
Default

Try this

x = 3
y = 10
Rows(x & ":" & y).Select


--
Regards Ron de Bruin
http://www.rondebruin.nl


" wrote in message
...
Ok I know how to write the code for selecting a row. Here is an example:
Rows("8:27").Select

What if instead of the number i want to use vairables such as:
Rows("x:y").Select

Can anyone tell me how to do this? If you can please email




  #3   Report Post  
Dana DeLouis
 
Posts: n/a
Default

Just some other options:

Sub Demo()
Dim x, y
x = 3
y = 10
Range(Rows(x), Rows(y)).Select
' or
Rows(x).Resize(y - x + 1).Select
End Sub

--
Dana DeLouis
Win XP & Office 2003


" wrote
in message ...
Ok I know how to write the code for selecting a row. Here is an example:
Rows("8:27").Select

What if instead of the number i want to use vairables such as:
Rows("x:y").Select

Can anyone tell me how to do this? If you can please email




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Make Change Case in Excel a format rather than formula Kevin Excel Worksheet Functions 1 March 18th 05 08:53 PM
Error trapped only while stepping through the code - Not triggered when run Jeff Excel Discussion (Misc queries) 7 March 7th 05 06:29 PM
Opening a file with code without a set file name jenkinspat Excel Discussion (Misc queries) 1 March 4th 05 10:50 AM
Opening a file with code without a set file name jenkinspat Excel Discussion (Misc queries) 1 March 3rd 05 03:40 PM
Error trapped only while stepping through the code - Not triggered when run Jeff Excel Discussion (Misc queries) 0 February 28th 05 06:26 PM


All times are GMT +1. The time now is 05:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"