Vba and excel, userform help

  • Thread starter Thread starter Jippo
  • Start date Start date
J

Jippo

Hi you all ,
here again with my stupid questions....

I have a workbook xxxx.xls and there is only one sheet with currency data.

In cell A99 is a sum from column A. What is the best way to show it in
Userform and how do I add there some text when the sum is negative?

Hope I explained it clearly enough...
 
Jippo

Put this together in a userform's initialize event. The value is in A99 of
a sheet called Sheet1 and it displays in a label called label1 on a
userform. (It doesn't matter what the user form is called as it is in the
userforms code module so I can simply use the keyword me

Private Sub UserForm_Initialize()
Dim dTotal As Double
Dim sText As String
dTotal = Worksheets("Sheet1").Range("A99").Value
If dTotal < 0 Then sText = "Value in A99 is minus " & dTotal
If dTotal >= 0 Then sText = "Value is A99 is " & dTotal
Me.Label1.Caption = sText
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
 
Thanks!!!!!!

Saved My day! Here's a virtual beer for your your trouble [ ]>

-jippo-
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top