AaronBanker
asked on
Public Sub, Empty Cell
I have many textboxes to change data. the first Sub below was working, but with a few hundred textboxes this code slowed down the program. So I made a public sum, as seen below, but i kept getting the value of c = "Empty"
what am i doing wrong?
__________ _________
what am i doing wrong?
Private Sub TextBox1_Change()
If wsMenu.Cells(12, 3).Value = "081" Then wsRoll.Cells(2, 7) = TextBox1.Value
If wsMenu.Cells(12, 3).Value = "082" Then wsRoll.Cells(494, 7) = TextBox1.Value
If wsMenu.Cells(12, 3).Value = "083" Then wsRoll.Cells(986, 7) = TextBox1.Value
If wsMenu.Cells(12, 3).Value = "084" Then wsRoll.Cells(1478, 7) = TextBox1.Value
If wsMenu.Cells(12, 3).Value = "085" Then wsRoll.Cells(1970, 7) = TextBox1.Value
If wsMenu.Cells(12, 3).Value = "086" Then wsRoll.Cells(2462, 7) = TextBox1.Value
If wsMenu.Cells(12, 3).Value = "087" Then wsRoll.Cells(2954, 7) = TextBox1.Value
If wsMenu.Cells(12, 3).Value = "099" Then wsRoll.Cells(3446, 7) = TextBox1.Value
End Sub
__________________________Public Sub CellLocation()
Dim c As Integer
If wsMenu.Cells(12, 3).Value = "081" Then c = 2
If wsMenu.Cells(12, 3).Value = "082" Then c = 494
If wsMenu.Cells(12, 3).Value = "083" Then c = 986
If wsMenu.Cells(12, 3).Value = "084" Then c = 1478
If wsMenu.Cells(12, 3).Value = "085" Then c = 1970
If wsMenu.Cells(12, 3).Value = "086" Then c = 2462
If wsMenu.Cells(12, 3).Value = "087" Then c = 2954
If wsMenu.Cells(12, 3).Value = "099" Then c = 3446
End Sub
Private Sub TextBox1_Change()
CellLocation
wsRoll.Cells(c, 7).Value = TextBox1.Value
UpdateSheet
End Sub
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Qlemo:
would the next textbox be
Private Sub TextBox2_Change()
wsRoll.Cells(CellLocation( )+1, 7).Value = TextBox1.Value
UpdateSheet
End Sub
Private Sub TextBox2_Change()
wsRoll.Cells(CellLocation( )+2, 7).Value = TextBox1.Value
UpdateSheet
End Sub
would the next textbox be
Private Sub TextBox2_Change()
wsRoll.Cells(CellLocation(
UpdateSheet
End Sub
Private Sub TextBox2_Change()
wsRoll.Cells(CellLocation(
UpdateSheet
End Sub
I cannot tell whether your code is correct for what you are after, but syntactically it would work that way - if you name the subs correctly (the last sub needs to be TextBox3_Change()). And I suppose you want to change Textbox1.value to the respective one.
ASKER
this doesn't seem to work
ASKER