Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a userform with a refedit control called reDataStart where the
user inputs where the beginning of the data is. When I try to execute the macro, I get a compile error that the variable is not defined. But the control is named. userf1021Mid.Show vbModeless Set rColHdr = Range(reDataStrt.Value) How do I tell VBA that reDataStrt is the control in the userform? All the examples I could find in the NG didn't mention this being neccessary. Why is this one different? Thanks. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Perhaps I am seeing this a bit out of context. You show the user form and
then immediately try to set the range object to the RefEdit on that form. Has the RefEdit been filled in yet? Shouldn't you be setting the range based on a change in the RefEdit? -- HTH... Jim Thomlinson "davegb" wrote: I have a userform with a refedit control called reDataStart where the user inputs where the beginning of the data is. When I try to execute the macro, I get a compile error that the variable is not defined. But the control is named. userf1021Mid.Show vbModeless Set rColHdr = Range(reDataStrt.Value) How do I tell VBA that reDataStrt is the control in the userform? All the examples I could find in the NG didn't mention this being neccessary. Why is this one different? Thanks. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Controls in the userform do not need the userform prefix to identify them as long as the code resides in the form module. If you are in another module then you must specify where the control is... Set rColHdr = Range(userf1021Mid.reDataStrt.Value) Do this before unloading the form. -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware "davegb" wrote in message I have a userform with a refedit control called reDataStart where the user inputs where the beginning of the data is. When I try to execute the macro, I get a compile error that the variable is not defined. But the control is named. userf1021Mid.Show vbModeless Set rColHdr = Range(reDataStrt.Value) How do I tell VBA that reDataStrt is the control in the userform? All the examples I could find in the NG didn't mention this being neccessary. Why is this one different? Thanks. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Jim Thomlinson wrote: Perhaps I am seeing this a bit out of context. You show the user form and then immediately try to set the range object to the RefEdit on that form. Has the RefEdit been filled in yet? Shouldn't you be setting the range based on a change in the RefEdit? -- Thanks for your reply. The refedit can't be filled in yet because this is a compile error. The userform hasn't made it onscreen yet. The intent of the code is to show the userform, the user fill it in, then when ok is clicked, come back to the macro and set the variable. I tried it by setting the variable in the userform code, but now the macro is somehow invisible to XL. When I try to run the macro from a tool, I get a "Macro ExtractTop10 not found" error. When I try to run the macro from the list, nothing happens. The macro box closes, but the macro doesn't run and there's no error message. It's as if I erased the macro entirely, but it's still there. Very weird! Is there some other way to accomplish all this? HTH... Jim Thomlinson "davegb" wrote: I have a userform with a refedit control called reDataStart where the user inputs where the beginning of the data is. When I try to execute the macro, I get a compile error that the variable is not defined. But the control is named. userf1021Mid.Show vbModeless Set rColHdr = Range(reDataStrt.Value) How do I tell VBA that reDataStrt is the control in the userform? All the examples I could find in the NG didn't mention this being neccessary. Why is this one different? Thanks. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Jim Cone wrote: Controls in the userform do not need the userform prefix to identify them as long as the code resides in the form module. If you are in another module then you must specify where the control is... Set rColHdr = Range(userf1021Mid.reDataStrt.Value) Do this before unloading the form. Pretty much what I did. See above post for results. -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware "davegb" wrote in message I have a userform with a refedit control called reDataStart where the user inputs where the beginning of the data is. When I try to execute the macro, I get a compile error that the variable is not defined. But the control is named. userf1021Mid.Show vbModeless Set rColHdr = Range(reDataStrt.Value) How do I tell VBA that reDataStrt is the control in the userform? All the examples I could find in the NG didn't mention this being neccessary. Why is this one different? Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Refedit Control | Excel Programming | |||
RefEdit control | Excel Programming | |||
RefEdit control | Excel Programming | |||
Shift-Control Arrow and RefEdit Control? | Excel Programming | |||
RefEdit control bug | Excel Programming |