Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default Editing a for each next loop

Hi
How do I instead of selecting the range B6:Bb14 below tell excel to loop
starting from b6 and continue down till the cell in col B is empty?

?Sub PasteData()

Dim r As Range

For Each r In Worksheets("Makron").Range("B6:B14")
GetPortfolioData Portfolio:=r.Value
Next

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default Editing a for each next loop

Ah, that worked! Great!

Many thanks!




"Gary''s Student" skrev:

You can test for empty in the loop:

Sub PasteData()

Dim r As Range

For Each r In Worksheets("Makron").Range("B6:B14")
If IsEmpty(r.Value) Then
Exit For
End If
GetPortfolioData Portfolio:=r.Value
Next

End Sub
--
Gary''s Student


"sverre" wrote:

Hi
How do I instead of selecting the range B6:Bb14 below tell excel to loop
starting from b6 and continue down till the cell in col B is empty?

?Sub PasteData()

Dim r As Range

For Each r In Worksheets("Makron").Range("B6:B14")
GetPortfolioData Portfolio:=r.Value
Next

End Sub

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
Editing a for each next loop Gary''s Student Excel Programming 0 August 8th 06 10:15 AM
For Each ... Next loop - need to reference the loop variable [email protected] Excel Programming 4 July 13th 06 06:12 PM
Advancing outer Loop Based on criteria of inner loop ExcelMonkey Excel Programming 1 August 15th 05 05:23 PM
Problem adding charts using Do-Loop Until loop Chris Bromley[_2_] Excel Programming 2 May 23rd 05 01:31 PM
HELP!!!! Can't stop a loop (NOT an infinite loop) TBA[_2_] Excel Programming 3 December 14th 03 03:33 PM


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