Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default how to select multiple rows using vba

I want to select multiple rows (so I can then sort them)

This is what I have so far:

Do While Worksheets(I).Cells(InputRow, 1).Value < ""
Rows(InputRow).Select
InputRow = InputRow + 1
Loop

But it just highlights the specific row everytime it goes through th
loop and the one that was highlighted is not anymore.

I want to have the rows STAY highlighted after it goes through th
loop.

Thanks:

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default how to select multiple rows using vba

Are you SURE you want to select all those rows? I ask because, wit
VERY few exceptions, it is just as effective and MUCH faster to do th
same job without selecting anything at all. If you post a little mor
detail about what you're trying to accomplish maybe we could make som
suggestions about how you're going about it. - Piku

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default how to select multiple rows using vba

Try something like

Do While Worksheets(I).Cells(InputRow, 1).Value < ""
Range(Cells(1, 1), Cells(InputRow, 1)).EntireRow.Select
InputRow = InputRow + 1
Loop


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"almostthere " wrote
in message ...
I want to select multiple rows (so I can then sort them)

This is what I have so far:

Do While Worksheets(I).Cells(InputRow, 1).Value < ""
Rows(InputRow).Select
InputRow = InputRow + 1
Loop

But it just highlights the specific row everytime it goes

through the
loop and the one that was highlighted is not anymore.

I want to have the rows STAY highlighted after it goes through

the
loop.

Thanks:)


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default how to select multiple rows using vba

Well I am trying to find a way to sort a certain number of cells
alphabetically. Selecting the rows, then sorting them is the only wa
I could think of doing it.

For example say i have this

Row 34: Burkom, Diane
Row 35: Hartford, Pamela
Row 36: Adrian, Steve
Row 37: (Blank)

InputRow currently has the value 34, and so I want to be able to onl
sort rows 34 through 36.

Make better sense? Please let me know. Thanks

Cheer

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default how to select multiple rows using vba

Oh and there are various columns to each row, containing number of hour
worked for each across the number of months

--
Message posted from http://www.ExcelForum.com



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default how to select multiple rows using vba

Chip Pearson wrote:
[b]Try something like

Do While Worksheets(I).Cells(InputRow, 1).Value < ""
Range(Cells(1, 1), Cells(InputRow, 1)).EntireRow.Select
InputRow = InputRow + 1
Loop



Worked Great!!! Thanks:

--
Message posted from http://www.ExcelForum.com

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default how to select multiple rows using vba

I had a little trouble with that code because it would highlight all o
the rows above InputRow. So what I did was create another variabl
("InputRow2") and did not change that variable in the loop. Jus
posting this in case someone else is has same question.

Dim InputRow As Integer
Dim InputRow2 As Integer
InputRow = 55
InputRow2 = InputRow

Do While Worksheets("Summary").Cells(InputRow, 1).Value < ""
Range(Cells(InputRow2, 1), Cells(InputRow, 1)).EntireRow.Select
InputRow = InputRow + 1
Loop
End Su

--
Message posted from http://www.ExcelForum.com

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
Select multiple rows not next to each other LarryJNX Excel Worksheet Functions 3 April 4th 23 02:20 PM
select multiple rows and format sdg8481 Excel Discussion (Misc queries) 7 October 5th 08 03:46 PM
Filter/Select multiple rows a_moron Excel Discussion (Misc queries) 5 January 20th 06 02:41 PM
How do I select multiple rows randomly in MS Excel? Varun Excel Discussion (Misc queries) 2 April 18th 05 08:10 AM
Select all data, multiple rows George Wilson Excel Discussion (Misc queries) 6 December 5th 04 08:16 PM


All times are GMT +1. The time now is 02:07 PM.

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

About Us

"It's about Microsoft Excel"