![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: South UK
Posts: 344
|
Hi everyone
Im trying to find a way select several rows at the same time but starting at say row 3 and then alternate rows so rows 3,5,7,9 etc Can anyone advise please regards Kevin |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Allentown, PA
Posts: 2,510
|
Just manually? Hold the ctrl key while you click on row numbers.
__________________
~Anne Troy |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Location: Tulsa, OK
Posts: 354
|
Are you trying to do that manually or from a macro?
|
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
You can adapt this to your needs and maybe throw it in a for loop or something.
Range("3:3,5:5,7:7,9:9").Select
__________________
Kind regards, Al Chara |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Feb 2002
Location: South UK
Posts: 344
|
I would prefer doing it by macro if i can as there are some 200 rows that I'm looking to work with.
I want to hide and unhide them again using code. Kev |
|
|
|
|
|
#6 |
|
Board Regular
Join Date: Feb 2002
Location: South UK
Posts: 344
|
Al
Many thanks,I'll give that a try Kev |
|
|
|
|
|
#7 |
|
Board Regular
Join Date: Mar 2002
Location: London, UK
Posts: 167
|
well in that case you don't need to actually select them...
Sub hide_alternates() For rowx = 2 To 200 Step 2 Cells(rowx, 1).RowHeight = 0 Next End Sub Sub unhide_alternates() For rowx = 2 To 200 Step 2 Cells(rowx, 1).EntireRow.AutoFit Next End Sub |
|
|
|
|
|
#8 |
|
Board Regular
Join Date: Feb 2002
Location: South UK
Posts: 344
|
Daleyman
Yep that looks like just the thing I need thank you And thanks to everyone for your response's Kev |
|
|
|
|
|
#9 |
|
New Member
Join Date: Apr 2002
Location: Kansas
Posts: 5
|
Sub hide_Alternates()
For x = 2 To 200 Step 2 Cells(x, 1).EntireRow.Hidden = True 'switch =False to unhide Next End Sub |
|
|
|
|
|
#10 | |
|
MrExcel MVP
Join Date: Mar 2002
Location: Chicago, IL USA
Posts: 2,042
|
Quote:
Here is an interesting way to switch back and forth, rather than your commented out section (=false) ------------------ Sub toggle_row_setting() Application.ScreenUpdating = False For x = 2 To 200 Step 2 Rows(x).Hidden = Not Rows(x).Hidden Next Application.ScreenUpdating = True End Sub -------------------- Same idea, less writing. Regards, Jay |
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|