Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi Fellow KnuckleRiders, I'm won

Status
Not open for further replies.

Dedcrayzie

Technical User
Apr 2, 2003
23
US
Hi Fellow KnuckleRiders,

I'm wondering if y'all can help me out on this one. I'm fairly new to VBA myself but with a few inputs was able to come up with the code below. What I didn't do however was clear the value out of the userform after it had been entered. Any pointers please?

************************************************************
Private Sub CommandButton1_Click()
Worksheets(2).Cells(entryCount + 7, 8).Value = TextBox1.Value
UserForm1.Hide
End Sub

Private Sub UserForm_Activate()
Dim B As Integer
Dim strMsg As String
Dim strDate As String

entryCount = 0
strMsg = "For the current period, "

For B = 7 To 20
If Not Worksheets(2).Cells(B, 8).Value = "" Then
entryCount = entryCount + 1
End If
Next

strDate = Worksheets(2).Cells(entryCount + 7, 4).Value

strMsg = strMsg & entryCount & " of 14 dates" & vbCrLf & _
"already have exchange rates entered." & vbCrLf & vbCrLf & _
"Enter exchange rate for " & strDate & " below."
Label1.Caption = strMsg
End Sub
************************************************************

Cheers Fellas,

[afro]
 
I'm not sure If I am following you or not but this might be what you want... rather than
UserForm1.Hide
use
Unload Me
 
Hi SS,

I'm presuming Unload Me unloads the entire userform. What I'm hoping to achieve is clear out the textbox value after the previous entry has populated the workbook. Essentially if the previous textbox value was 0.7055, when I hit the 'Enter' button the workbook is populated with 0.7055 and the textbox being cleared of that value.

Thx
[afro]
 
Private Sub CommandButton1_Click()
Worksheets(2).Cells(entryCount + 7, 8).Value = TextBox1.Value
Textbox1.text = ""
UserForm1.Hide
End Sub

Rgds
Geoff
Si hoc legere scis, nimis eruditionis habes
 
After the line in code where you add the value to the workbook, simply put the code:
TextBox1.Value = ""
 
Suppose I could make it three identical answers but had the sense (??) to check whether xlbo had posted before I did!!

Friday?
;-)

If a man says something and there are no women there to hear him, is he still wrong? [ponder]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top