#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 25
Default Selecting rows.

Dear All,

I hope you have a correct idea for my question I am asking to select rows in data with the help of loop. Please note that what i want is to run a loop select a row move next and keep the previous row selected too. I need a efficient code for this.


Sorry to say I was not looking for this , Try to run this code it will select 1 to 10 rows. Lets change the code little bit run it and found it's still selecting all what i want is select rows after every three and keep the previous rows selected too. Every one can do a operation with alternate rows even i can do the same. here the point is select next row keeping the previous rows selected too.

Sub SelRows()
Dim R
For R = 1 To 100 step 3
Range(Cells(1, "A"), Cells(R, "A")).EntireRow.Select
Next R
End Sub

Regards,
Mandeep Baluja.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 852
Default Selecting rows.

I think it doing what you want, see if with the MsgBox to pause the loop if that is not what you want.


Sub SelRows()
Dim R
For R = 1 To 10 'Step 3
Range(Cells(1, "A"), Cells(R, "A")).EntireRow.Select
MsgBox "Row " & R & " selected"
Next R
End Sub


Howard
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 25
Default Selecting rows.

No body is getting me how to select alternate rows. like 1 , 3 , 5, 7


On Tuesday, November 25, 2014 9:42:51 AM UTC+5:30, Mandeep Baluja wrote:
Dear All,

I hope you have a correct idea for my question I am asking to select rows in data with the help of loop. Please note that what i want is to run a loop select a row move next and keep the previous row selected too. I need a efficient code for this.


Sorry to say I was not looking for this , Try to run this code it will select 1 to 10 rows. Lets change the code little bit run it and found it's still selecting all what i want is select rows after every three and keep the previous rows selected too. Every one can do a operation with alternate rows even i can do the same. here the point is select next row keeping the previous rows selected too.

Sub SelRows()
Dim R
For R = 1 To 100 step 3
Range(Cells(1, "A"), Cells(R, "A")).EntireRow.Select
Next R
End Sub

Regards,
Mandeep Baluja.


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,872
Default Selecting rows.

Hi;

Am Mon, 24 Nov 2014 20:12:48 -0800 (PST) schrieb Mandeep Baluja:

Sub SelRows()
Dim R
For R = 1 To 100 step 3
Range(Cells(1, "A"), Cells(R, "A")).EntireRow.Select
Next R
End Sub


try:

Sub Test()
Dim i As Long
Dim rngBig As Range

For i = 1 To 100 Step 3
If rngBig Is Nothing Then
Set rngBig = Rows(i)
Else
Set rngBig = Union(rngBig, Rows(i))
End If
Next
rngBig.Select
End Sub


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional
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
Selecting certain Rows and Copying cells in those rows to new work Jinx123 Excel Programming 1 June 8th 10 01:47 PM
after selecting 50 rows of a column i can't reference the cells in the rows Bob Salzer New Users to Excel 2 July 21st 06 10:29 PM
Removing Empty Rows and selecting Specific Rows Jetheat[_8_] Excel Programming 7 August 12th 05 12:10 AM
Selecting Rows Alan Excel Programming 4 October 16th 03 09:10 PM
selecting rows CiaraG Excel Programming 0 August 8th 03 10:07 AM


All times are GMT +1. The time now is 05:44 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"