ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Forms (https://www.excelbanter.com/excel-programming/339646-forms.html)

Steve

Forms
 
Can you please help?

I have a form with text boxes in (4).

On a hidden sheet I will place the names A24-A27.

What I want to do is when I load the form, check to see if any names are
there and if so populate the text boxes.

Where do I do this?

Thanks
--
Steve R

Tom Ogilvy

Forms
 
Private Sub Userform_Initialize()
Dim sh as Worksheet
Dim i as Long
set sh = Worksheets("MyHiddenSheetName")
for i = 1 to 4
if(sh.cells(i+23,1).Value) < "" then
me.controls("TextBox" & i).Value = _
sh.Cells(i+23,1).Value)
end if
Next
End Sub

You could actually skip the if test, but you asked for it.

--
Regards,
Tom Ogilvy

"Steve" wrote in message
...
Can you please help?

I have a form with text boxes in (4).

On a hidden sheet I will place the names A24-A27.

What I want to do is when I load the form, check to see if any names are
there and if so populate the text boxes.

Where do I do this?

Thanks
--
Steve R





All times are GMT +1. The time now is 12:21 AM.

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