ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Loop until TextBox7.Value = 0 Not working...Please help! (https://www.excelbanter.com/excel-programming/385681-loop-until-textbox7-value-%3D-0-not-working-please-help.html)

[email protected]

Loop until TextBox7.Value = 0 Not working...Please help!
 
I am having some problems with the code below. I am trying to get the
macro to run until the value in Textbox7 = 0 but for whatever reason
the macro will only run once until I hit the button for it load again.
I am just simply looking to get the macro to run until textbox7.value
= 0. Any ideas? Your help is much appreciated!

-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


JLGWhiz

Loop until TextBox7.Value = 0 Not working...Please help!
 
I don't see anything in the posted code that would make Textbox7 go to zero.
It looks like a perpetual loop.

" wrote:

I am having some problems with the code below. I am trying to get the
macro to run until the value in Textbox7 = 0 but for whatever reason
the macro will only run once until I hit the button for it load again.
I am just simply looking to get the macro to run until textbox7.value
= 0. Any ideas? Your help is much appreciated!

-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



merjet

Loop until TextBox7.Value = 0 Not working...Please help!
 
While a TextBox.Value may be "0" or "", it is never going to be 0 (the
number, because it is text).

Hth,
Merjet



merjet

Loop until TextBox7.Value = 0 Not working...Please help!
 
P.S. Val(TextBox1.Value) can be 0.

Merjet




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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com