Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default Issues with Looping macro...Do Until TextBox7.Value = 0 but it's crashing...Why?

The code below is my attempt at getting the macro to run the code
below with the "DO" command until TextBox7.Value = 0, however, I am
getting error messages saying "Loop without DO" or when I switch them
it says "DO without Loop". Any ideas as to what the heck is wrong with
this macro?
Your help is much appreciated! Thanks!

-Todd

'========================
Do
'========================
If TextBox7.Value 0 Then
Sheets("export").Select
TextBox5.Value = Sheets("export").Range("GX1").Value
TextBox6.Value = Sheets("export").Range("HB1").Value
TextBox7.Value = Sheets("export").Range("HE1").Value
TextBox11.Value = Sheets("EXPORT").Range("HH1").Value
TextBox10.Value = Sheets("EXPORT").Range("HK1").Value
TextBox9.Value = Sheets("EXPORT").Range("HN1").Value
TextBox8.Value = Sheets("EXPORT").Range("HQ1").Value
TextBox13.Value = Sheets("EXPORT").Range("HT1").Value
TextBox12.Value = Sheets("EXPORT").Range("HW1").Value
Range(TextBox6.Value).Select
ActiveCell.FormulaR1C1 = TextBox7.Value
Range(TextBox6.Value).AutoFill Destination:=Range(TextBox5.Value)

If TextBox13.Value = 0 Then
Unload Me
UserForm1.Show
End If

If TextBox13.Value 0 Then
Sheets("export").Range("IB3").Select
ActiveCell.Value = ActiveCell.Value + 1
Range(TextBox13.Value).Select
ActiveCell.Value = "X"
Range("A1").Select
Unload Me
UserForm1.Show
End If

If TextBox7.Value = 0 Then
MsgBox "Last Value Already Inserted", vbCritical, "- No More Data to
Insert -"
Exit Sub
End If

'========================
Loop Until TextBox7.Value = 0
'========================

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 340
Default Issues with Looping macro...Do Until TextBox7.Value = 0 but it's crashing...Why?

You are missing an end if for "If textbox7.value 0 then". The VBA
compiler gets confused sometimes.....

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

wrote in message
oups.com...
The code below is my attempt at getting the macro to run the code
below with the "DO" command until TextBox7.Value = 0, however, I am
getting error messages saying "Loop without DO" or when I switch them
it says "DO without Loop". Any ideas as to what the heck is wrong with
this macro?
Your help is much appreciated! Thanks!

-Todd

'========================
Do
'========================
If TextBox7.Value 0 Then
Sheets("export").Select
TextBox5.Value = Sheets("export").Range("GX1").Value
TextBox6.Value = Sheets("export").Range("HB1").Value
TextBox7.Value = Sheets("export").Range("HE1").Value
TextBox11.Value = Sheets("EXPORT").Range("HH1").Value
TextBox10.Value = Sheets("EXPORT").Range("HK1").Value
TextBox9.Value = Sheets("EXPORT").Range("HN1").Value
TextBox8.Value = Sheets("EXPORT").Range("HQ1").Value
TextBox13.Value = Sheets("EXPORT").Range("HT1").Value
TextBox12.Value = Sheets("EXPORT").Range("HW1").Value
Range(TextBox6.Value).Select
ActiveCell.FormulaR1C1 = TextBox7.Value
Range(TextBox6.Value).AutoFill Destination:=Range(TextBox5.Value)

If TextBox13.Value = 0 Then
Unload Me
UserForm1.Show
End If

If TextBox13.Value 0 Then
Sheets("export").Range("IB3").Select
ActiveCell.Value = ActiveCell.Value + 1
Range(TextBox13.Value).Select
ActiveCell.Value = "X"
Range("A1").Select
Unload Me
UserForm1.Show
End If

If TextBox7.Value = 0 Then
MsgBox "Last Value Already Inserted", vbCritical, "- No More Data to
Insert -"
Exit Sub
End If

'========================
Loop Until TextBox7.Value = 0
'========================

End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default Issues with Looping macro...Do Until TextBox7.Value = 0 but it's crashing...Why?

On Mar 18, 10:57 pm, "Bob Flanagan" wrote:
You are missing an end if for "If textbox7.value 0 then". The VBA
compiler gets confused sometimes.....

Bob Flanagan
Macro Systemshttp://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

wrote in message

oups.com...



The code below is my attempt at getting the macro to run the code
below with the "DO" command until TextBox7.Value = 0, however, I am
getting error messages saying "Loop without DO" or when I switch them
it says "DO without Loop". Any ideas as to what the heck is wrong with
this macro?
Your help is much appreciated! Thanks!


-Todd


'========================
Do
'========================
If TextBox7.Value 0 Then
Sheets("export").Select
TextBox5.Value = Sheets("export").Range("GX1").Value
TextBox6.Value = Sheets("export").Range("HB1").Value
TextBox7.Value = Sheets("export").Range("HE1").Value
TextBox11.Value = Sheets("EXPORT").Range("HH1").Value
TextBox10.Value = Sheets("EXPORT").Range("HK1").Value
TextBox9.Value = Sheets("EXPORT").Range("HN1").Value
TextBox8.Value = Sheets("EXPORT").Range("HQ1").Value
TextBox13.Value = Sheets("EXPORT").Range("HT1").Value
TextBox12.Value = Sheets("EXPORT").Range("HW1").Value
Range(TextBox6.Value).Select
ActiveCell.FormulaR1C1 = TextBox7.Value
Range(TextBox6.Value).AutoFill Destination:=Range(TextBox5.Value)


If TextBox13.Value = 0 Then
Unload Me
UserForm1.Show
End If


If TextBox13.Value 0 Then
Sheets("export").Range("IB3").Select
ActiveCell.Value = ActiveCell.Value + 1
Range(TextBox13.Value).Select
ActiveCell.Value = "X"
Range("A1").Select
Unload Me
UserForm1.Show
End If


If TextBox7.Value = 0 Then
MsgBox "Last Value Already Inserted", vbCritical, "- No More Data to
Insert -"
Exit Sub
End If


'========================
Loop Until TextBox7.Value = 0
'========================


End Sub- Hide quoted text -


- Show quoted text -


Bob,

I've end that IF statement but it still giving me the same message...
Thanks for catching btw...here is the changed code. Thanks Bob!

'========================
Do
'========================
If TextBox7.Value 0 Then
Sheets("export").Select
TextBox5.Value = Sheets("export").Range("GX1").Value
TextBox6.Value = Sheets("export").Range("HB1").Value
TextBox7.Value = Sheets("export").Range("HE1").Value
TextBox11.Value = Sheets("EXPORT").Range("HH1").Value
TextBox10.Value = Sheets("EXPORT").Range("HK1").Value
TextBox9.Value = Sheets("EXPORT").Range("HN1").Value
TextBox8.Value = Sheets("EXPORT").Range("HQ1").Value
TextBox13.Value = Sheets("EXPORT").Range("HT1").Value
TextBox12.Value = Sheets("EXPORT").Range("HW1").Value
Range(TextBox6.Value).Select
ActiveCell.FormulaR1C1 = TextBox7.Value
Range(TextBox6.Value).AutoFill Destination:=Range(TextBox5.Value)
End If

If TextBox13.Value = 0 Then
Unload Me
UserForm1.Show
End If

If TextBox13.Value 0 Then
Sheets("export").Range("IB3").Select
ActiveCell.Value = ActiveCell.Value + 1
Range(TextBox13.Value).Select
ActiveCell.Value = "X"
Range("A1").Select
Unload Me
UserForm1.Show
End If

If TextBox7.Value = 0 Then
MsgBox "Last Value Already Inserted", vbCritical, "- No More Data to
Insert -"
End If

'========================
Loop Until TextBox7.Value = 0
'========================

End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default Issues with Looping macro...Do Until TextBox7.Value = 0 but it's crashing...Why?

On Mar 18, 10:57 pm, "Bob Flanagan" wrote:
You are missing an end if for "If textbox7.value 0 then". The VBA
compiler gets confused sometimes.....

Bob Flanagan
Macro Systemshttp://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

wrote in message

oups.com...



The code below is my attempt at getting the macro to run the code
below with the "DO" command until TextBox7.Value = 0, however, I am
getting error messages saying "Loop without DO" or when I switch them
it says "DO without Loop". Any ideas as to what the heck is wrong with
this macro?
Your help is much appreciated! Thanks!


-Todd


'========================
Do
'========================
If TextBox7.Value 0 Then
Sheets("export").Select
TextBox5.Value = Sheets("export").Range("GX1").Value
TextBox6.Value = Sheets("export").Range("HB1").Value
TextBox7.Value = Sheets("export").Range("HE1").Value
TextBox11.Value = Sheets("EXPORT").Range("HH1").Value
TextBox10.Value = Sheets("EXPORT").Range("HK1").Value
TextBox9.Value = Sheets("EXPORT").Range("HN1").Value
TextBox8.Value = Sheets("EXPORT").Range("HQ1").Value
TextBox13.Value = Sheets("EXPORT").Range("HT1").Value
TextBox12.Value = Sheets("EXPORT").Range("HW1").Value
Range(TextBox6.Value).Select
ActiveCell.FormulaR1C1 = TextBox7.Value
Range(TextBox6.Value).AutoFill Destination:=Range(TextBox5.Value)


If TextBox13.Value = 0 Then
Unload Me
UserForm1.Show
End If


If TextBox13.Value 0 Then
Sheets("export").Range("IB3").Select
ActiveCell.Value = ActiveCell.Value + 1
Range(TextBox13.Value).Select
ActiveCell.Value = "X"
Range("A1").Select
Unload Me
UserForm1.Show
End If


If TextBox7.Value = 0 Then
MsgBox "Last Value Already Inserted", vbCritical, "- No More Data to
Insert -"
Exit Sub
End If


'========================
Loop Until TextBox7.Value = 0
'========================


End Sub- Hide quoted text -


- Show quoted text -


Now the macro isn't looping correctly... TextBox7.Value will be equal
to 0 and it will continue to run even if the form is trying to be
closed so I've added the following to the code to the bottom. I can't
seem to get it to loop until TextBox7.Value is truly equal to 0. Any
ideas? Thanks!


'========================
Do
'========================
If TextBox7.Value 0 Then
Sheets("export").Select
TextBox5.Value = Sheets("export").Range("GX1").Value
TextBox6.Value = Sheets("export").Range("HB1").Value
TextBox7.Value = Sheets("export").Range("HE1").Value
TextBox11.Value = Sheets("EXPORT").Range("HH1").Value
TextBox10.Value = Sheets("EXPORT").Range("HK1").Value
TextBox9.Value = Sheets("EXPORT").Range("HN1").Value
TextBox8.Value = Sheets("EXPORT").Range("HQ1").Value
TextBox13.Value = Sheets("EXPORT").Range("HT1").Value
TextBox12.Value = Sheets("EXPORT").Range("HW1").Value
Range(TextBox6.Value).Select
ActiveCell.FormulaR1C1 = TextBox7.Value
Range(TextBox6.Value).AutoFill Destination:=Range(TextBox5.Value)
End If

If TextBox13.Value = 0 Then
Unload Me
UserForm1.Show
End If

If TextBox13.Value 0 Then
Sheets("export").Range("IB3").Select
ActiveCell.Value = ActiveCell.Value + 1
Range(TextBox13.Value).Select
ActiveCell.Value = "X"
Range("A1").Select
Unload Me
UserForm1.Show
End If


'========================
Loop Until TextBox7.Value = 0
'========================

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As
Integer)
'Prevent user from closing with the Close box in the title bar.
If CloseMode < 1 Then
Unload Me
End If
Exit Sub
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
Crashing Macro, Not Enough Memory [email protected] Excel Programming 2 October 7th 05 11:11 AM
Help with a crashing Macro needed Tadragh1 Excel Programming 6 August 13th 05 10:46 PM
Macro crashing on different computer Grace[_3_] Excel Programming 8 July 8th 04 04:12 AM
Macro Crashing Excel ultra_xcyter[_3_] Excel Programming 0 June 28th 04 02:56 PM
Looping Macro Pete Excel Programming 3 February 18th 04 05:33 PM


All times are GMT +1. The time now is 12:32 AM.

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"