#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Do Loop

I need help with the following VB Excel Do Loop Statement:
In lame men terms

Private Sub CommandButton1_Click()
Range = Row
Do while €˜the cell in row 1 is empty

If €˜the cell is empty then
Select the cell and drop Text Box1 information (From A User form) in to the
empty cell
(Like €œA10€ ) and Text Box2 Information into the cell next to it. (Like
€œB10€).
Else

Row +1

Loop

End if
End if

End Sub

Thank you very much for any Feedback. Please Also include, If okay, a E-Mail
Address for possible further Questions.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Do Loop

Bob

You had two replies to this question on the 19th.
From Tom Ogilvy:
Private Sub CommandButton1_Click()
dim r as Long
r = 1
Do while Not isempty(cells(r,1))
r = r + 1
Loop
Cells(r,1) = Textbox1.Text
Cells(r,2) = Textbox2.Text
End Sub

And from Charlie:
Dim EmptyCell As Range
For Each EmptyCell In Range("1:1").Cells
If IsEmpty(EmptyCell) Then
Cells(EmptyCell.Row, EmptyCell.Column) = Textbox1.Text
Cells(EmptyCell.Row + 1, EmptyCell.Column) = Textbox2.Text
End If
Next EmptyCell

If neither of these is doing what you want you need to rephrase your
question and give us more detail, eg what data do you already have in Column
A and what do you expect to see once this loop has run.

Regards
Rowan

"BobBarker" wrote:

I need help with the following VB Excel Do Loop Statement:
In lame men terms

Private Sub CommandButton1_Click()
Range = Row
Do while €˜the cell in row 1 is empty

If €˜the cell is empty then
Select the cell and drop Text Box1 information (From A User form) in to the
empty cell
(Like €œA10€ ) and Text Box2 Information into the cell next to it. (Like
€œB10€).
Else

Row +1

Loop

End if
End if

End Sub

Thank you very much for any Feedback. Please Also include, If okay, a E-Mail
Address for possible further Questions.

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
Advancing outer Loop Based on criteria of inner loop ExcelMonkey Excel Programming 1 August 15th 05 05:23 PM
Loop Function unable to loop Junior728 Excel Programming 1 July 28th 05 10:23 AM
Problem adding charts using Do-Loop Until loop Chris Bromley[_2_] Excel Programming 2 May 23rd 05 01:31 PM
How do I create a For loop within a For loop? Linking to specific cells in pivot table Excel Programming 2 January 24th 05 08:05 AM
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 01:12 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"