Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 51
Default A little excel vb help ?

"Bob Phillips" wrote in
:

Bob,

Using;

For RowCount = 3 To Selection.Rows.Count ' Start at Row 3

I can loop through selected Rows - Can I just loop through ALL the Rows
that exist (starting at Row 3) ? so the user does not have to select the
rows first ?

Thanks

PS - I think I have found that Cells.(x,y) seems to reference individual
cells as per my last question ? Is this the best way.

Thanks again
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default A little excel vb help ?

Your use of Cells(x,y) is as good a way as any.

As for working through rows without the user having to select them all
first, you can do that also. First step is to determine a column that will
always have some entry in a cell in it in the last used row. For this
example we'll assume it is column B. Then you can use this as your FOR
statement:

For RowCount = 3 To _
Range("B" & Rows.Count).End(xlUp).Row



"Isis" wrote:

"Bob Phillips" wrote in
:

Bob,

Using;

For RowCount = 3 To Selection.Rows.Count ' Start at Row 3

I can loop through selected Rows - Can I just loop through ALL the Rows
that exist (starting at Row 3) ? so the user does not have to select the
rows first ?

Thanks

PS - I think I have found that Cells.(x,y) seems to reference individual
cells as per my last question ? Is this the best way.

Thanks again

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 51
Default A little excel vb help ?

?B?SkxhdGhhbQ==?= <HelpFrom @ Jlathamsite.com.(removethis) wrote in
:

For RowCount = 3 To _
Range("B" & Rows.Count).End(xlUp).Row


Not quite sure whom I am thanking, but Thank You - that seems to work.
Could I also have used SpecialCells somehow - just asking out of interest.

Thanks
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default A little excel vb help ?

I think the thanks should go to Bob, he provided the meat of the solution
while I just gave you one minor change.

You might or might not be able to use one of the SpecialCells, but that's
iffy at times depending the worksheet. The way I provided is a 'sure thing'
although if row 3 is empty in that column and nothing below it in the column,
then you will get an error when it attempts to execute.

"Isis" wrote:

?B?SkxhdGhhbQ==?= <HelpFrom @ Jlathamsite.com.(removethis) wrote in
:

For RowCount = 3 To _
Range("B" & Rows.Count).End(xlUp).Row


Not quite sure whom I am thanking, but Thank You - that seems to work.
Could I also have used SpecialCells somehow - just asking out of interest.

Thanks

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



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