ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Vba and excel, userform help (https://www.excelbanter.com/excel-programming/312279-vba-excel-userform-help.html)

Jippo

Vba and excel, userform help
 
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...




Nick Hodge

Vba and excel, userform help
 
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
HIS


"Jippo" wrote in message
...
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

Vba and excel, userform help
 
Thanks!!!!!!

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

-jippo-


"Nick Hodge" wrote in message
...
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
HIS


"Jippo" wrote in message
...
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...









All times are GMT +1. The time now is 05:12 PM.

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