1r3o2n8
asked on
Upper case in text box
Private Sub Calendar1_Click()
TextBox1.Text = Format(Calendar1.Value, "mm/dd/yy")
'inserts date into textbox1
End Sub
Private Sub CkBoxIncoming_Click()
End Sub
Private Sub CmdBtnCloseForm_Click()
Unload Me 'removes form from spreadsheet with cmd btn.
End Sub
Private Sub CommandButton1_Click()
'inserts textbox data into spreadsheet fields.
Dim r As Range
Set r = Range("A40").End(xlUp) 'a65536
Set r = r.Offset(1, 0)
r.Value = TextBox1.Value
Set r = r.Offset(0, 1) 'moves right with each "1".
r.Value = TextBox2.Value
Set r = r.Offset(0, 1)
r.Value = TextBox3.Value
Set r = r.Offset(0, 1)
r.Value = TextBox4.Value
Set r = r.Offset(0, 1)
r.Value = CkBoxIncoming.Value
How do I force capital letters into the above text boxes?
How do I write the code in a better fashion with all the value lines? e.g. with or select?
ASKER
That works great. Thanks alot.
In that area of code where you made the ucase corrections, is there a way to recode it, perhaps with a "with" statement, that will reduce the amount of code?
In that area of code where you made the ucase corrections, is there a way to recode it, perhaps with a "with" statement, that will reduce the amount of code?
No but you can do this which is even more efficient
on error resume next
Dim r As Range
dim ws as worksheet
set ws = activesheet
Set r = ws.Range("A" & ws.Range("A40").End(xlUp).row + 1 & ":E" & ws.Range("A40").End(xlUp).row + 1) 'a65536
for each c in r
c.Value = ucase(me.controls("TextBox" & c.column).value)
next
Actually use this, don't use A40
on error resume next
Dim r As Range
dim ws as worksheet
set ws = activesheet
Set r = ws.Range("A" & ws.Range("A" & ws.range("A:A").rows.count).End(xlUp).row + 1 & ":E" & ws.Range("A" & ws.range("A:A").rows.count).End(xlUp).row + 1) 'a65536
for each c in r
c.Value = ucase(me.controls("TextBox" & c.column).value)
next
oops, I looked over your combobox.....check the below code of the fix.....
on error resume next
Dim r As Range
dim ws as worksheet
set ws = activesheet
Set r = ws.Range("A" & ws.Range("A" & ws.range("A:A").rows.count).End(xlUp).row + 1 & ":D" & ws.Range("A" & ws.range("A:A").rows.count).End(xlUp).row + 1) 'a65536
for each c in r
if c.column <> r.cells.count then
c.Value = ucase(me.controls("TextBox" & c.column).value)
else
c.value = CkBoxIncoming.Value
end if
next
ASKER
Your code did the job! May I have an explanation of lines 5-8??
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
THANX!
Open in new window