Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Put gotoDlist in the same module as Dlist_Change
-- Regards, Tom Ogilvy "Rob" wrote in message ... Thanks Jim, I tried that and I keep getting "Sub or Function not defined" "Jim Thomlinson" wrote: Private Sub DList_Change() Call GoToDList End Sub Sub GoToDList() Dim DNum DNum = DList.Value If DNum < "0" Then Range("A" & DNum).Activate End If DList.Value = "0" End Sub -- HTH... Jim Thomlinson "Rob" wrote: I have a ComboBox and Below is the code for it. The Code works perfectly as it should; there is absolutely no problems with the code, but here's my quandry... When I use, Private Sub DList_Change() Dim DNum DNum = DList.Value If DNum < "0" Then Range("A" & DNum).Activate End If DList.Value = "0" End Sub It works When I do this.... Private Sub DList_Change() ThisWorkbook.GoToDList End Sub and the code for GoToDList is... Sub GoToDList() Dim DNum DNum = DList.Value If DNum < "0" Then Range("A" & DNum).Activate End If DList.Value = "0" End Sub It doesn't work at all, I keep getting errors to debug. I don't understand; I use the exact same code. Thanks Very Much In Advance, Rob |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Or be more specific in your reference.
Call Worksheets("Sheet1").GotoDList() or Call ThisWorkbook.GotoDList() or ... Depending where you have put the code you may need to be very explicit in where the code resides. -- HTH... Jim Thomlinson "Tom Ogilvy" wrote: Put gotoDlist in the same module as Dlist_Change -- Regards, Tom Ogilvy "Rob" wrote in message ... Thanks Jim, I tried that and I keep getting "Sub or Function not defined" "Jim Thomlinson" wrote: Private Sub DList_Change() Call GoToDList End Sub Sub GoToDList() Dim DNum DNum = DList.Value If DNum < "0" Then Range("A" & DNum).Activate End If DList.Value = "0" End Sub -- HTH... Jim Thomlinson "Rob" wrote: I have a ComboBox and Below is the code for it. The Code works perfectly as it should; there is absolutely no problems with the code, but here's my quandry... When I use, Private Sub DList_Change() Dim DNum DNum = DList.Value If DNum < "0" Then Range("A" & DNum).Activate End If DList.Value = "0" End Sub It works When I do this.... Private Sub DList_Change() ThisWorkbook.GoToDList End Sub and the code for GoToDList is... Sub GoToDList() Dim DNum DNum = DList.Value If DNum < "0" Then Range("A" & DNum).Activate End If DList.Value = "0" End Sub It doesn't work at all, I keep getting errors to debug. I don't understand; I use the exact same code. Thanks Very Much In Advance, Rob |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
But then you are back to DList being unqualifed in the gotoDlist routine and
the OP suffering another failure and another stream of postings.. Yes it could be qualified as well, but since the OP is continuing to have problems, I suggested something that should get him working right away. Call ThisWorkbook.GotoDList() Seems the advice is getting circular. After all, his original post already had ThisWorkbook.GoToDList The implied discussion of Call or not to use Call or putting parentheses on the end are really meaningless. If you put parentheses on the end of a function with no arguments with Call, they are stripped off in my VBE and if you do it without using Call, then of course there is a syntax error. In any event, it has no bearing on the OP's problem. -- Regards, Tom Ogilvy "Jim Thomlinson" wrote in message ... Or be more specific in your reference. Call Worksheets("Sheet1").GotoDList() or Call ThisWorkbook.GotoDList() or ... Depending where you have put the code you may need to be very explicit in where the code resides. -- HTH... Jim Thomlinson "Tom Ogilvy" wrote: Put gotoDlist in the same module as Dlist_Change -- Regards, Tom Ogilvy "Rob" wrote in message ... Thanks Jim, I tried that and I keep getting "Sub or Function not defined" "Jim Thomlinson" wrote: Private Sub DList_Change() Call GoToDList End Sub Sub GoToDList() Dim DNum DNum = DList.Value If DNum < "0" Then Range("A" & DNum).Activate End If DList.Value = "0" End Sub -- HTH... Jim Thomlinson "Rob" wrote: I have a ComboBox and Below is the code for it. The Code works perfectly as it should; there is absolutely no problems with the code, but here's my quandry... When I use, Private Sub DList_Change() Dim DNum DNum = DList.Value If DNum < "0" Then Range("A" & DNum).Activate End If DList.Value = "0" End Sub It works When I do this.... Private Sub DList_Change() ThisWorkbook.GoToDList End Sub and the code for GoToDList is... Sub GoToDList() Dim DNum DNum = DList.Value If DNum < "0" Then Range("A" & DNum).Activate End If DList.Value = "0" End Sub It doesn't work at all, I keep getting errors to debug. I don't understand; I use the exact same code. Thanks Very Much In Advance, Rob |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
So basicly, when it comes to using VBA code for a ComboBox, I have to have
the actual code in that worksheet that the combobox is in instead of having it stored somewhere else and just calling or referencing it. If so Why is that. I ask because I would like to understand that rule. Thanks for ALL your help, Rob "Tom Ogilvy" wrote: But then you are back to DList being unqualifed in the gotoDlist routine and the OP suffering another failure and another stream of postings.. Yes it could be qualified as well, but since the OP is continuing to have problems, I suggested something that should get him working right away. Call ThisWorkbook.GotoDList() Seems the advice is getting circular. After all, his original post already had ThisWorkbook.GoToDList The implied discussion of Call or not to use Call or putting parentheses on the end are really meaningless. If you put parentheses on the end of a function with no arguments with Call, they are stripped off in my VBE and if you do it without using Call, then of course there is a syntax error. In any event, it has no bearing on the OP's problem. -- Regards, Tom Ogilvy "Jim Thomlinson" wrote in message ... Or be more specific in your reference. Call Worksheets("Sheet1").GotoDList() or Call ThisWorkbook.GotoDList() or ... Depending where you have put the code you may need to be very explicit in where the code resides. -- HTH... Jim Thomlinson "Tom Ogilvy" wrote: Put gotoDlist in the same module as Dlist_Change -- Regards, Tom Ogilvy "Rob" wrote in message ... Thanks Jim, I tried that and I keep getting "Sub or Function not defined" "Jim Thomlinson" wrote: Private Sub DList_Change() Call GoToDList End Sub Sub GoToDList() Dim DNum DNum = DList.Value If DNum < "0" Then Range("A" & DNum).Activate End If DList.Value = "0" End Sub -- HTH... Jim Thomlinson "Rob" wrote: I have a ComboBox and Below is the code for it. The Code works perfectly as it should; there is absolutely no problems with the code, but here's my quandry... When I use, Private Sub DList_Change() Dim DNum DNum = DList.Value If DNum < "0" Then Range("A" & DNum).Activate End If DList.Value = "0" End Sub It works When I do this.... Private Sub DList_Change() ThisWorkbook.GoToDList End Sub and the code for GoToDList is... Sub GoToDList() Dim DNum DNum = DList.Value If DNum < "0" Then Range("A" & DNum).Activate End If DList.Value = "0" End Sub It doesn't work at all, I keep getting errors to debug. I don't understand; I use the exact same code. Thanks Very Much In Advance, Rob |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
No, you just have to make sure that any objects referenced are properly
qualified. -- Regards, Tom Ogilvy "Rob" wrote in message ... So basicly, when it comes to using VBA code for a ComboBox, I have to have the actual code in that worksheet that the combobox is in instead of having it stored somewhere else and just calling or referencing it. If so Why is that. I ask because I would like to understand that rule. Thanks for ALL your help, Rob "Tom Ogilvy" wrote: But then you are back to DList being unqualifed in the gotoDlist routine and the OP suffering another failure and another stream of postings.. Yes it could be qualified as well, but since the OP is continuing to have problems, I suggested something that should get him working right away. Call ThisWorkbook.GotoDList() Seems the advice is getting circular. After all, his original post already had ThisWorkbook.GoToDList The implied discussion of Call or not to use Call or putting parentheses on the end are really meaningless. If you put parentheses on the end of a function with no arguments with Call, they are stripped off in my VBE and if you do it without using Call, then of course there is a syntax error. In any event, it has no bearing on the OP's problem. -- Regards, Tom Ogilvy "Jim Thomlinson" wrote in message ... Or be more specific in your reference. Call Worksheets("Sheet1").GotoDList() or Call ThisWorkbook.GotoDList() or ... Depending where you have put the code you may need to be very explicit in where the code resides. -- HTH... Jim Thomlinson "Tom Ogilvy" wrote: Put gotoDlist in the same module as Dlist_Change -- Regards, Tom Ogilvy "Rob" wrote in message ... Thanks Jim, I tried that and I keep getting "Sub or Function not defined" "Jim Thomlinson" wrote: Private Sub DList_Change() Call GoToDList End Sub Sub GoToDList() Dim DNum DNum = DList.Value If DNum < "0" Then Range("A" & DNum).Activate End If DList.Value = "0" End Sub -- HTH... Jim Thomlinson "Rob" wrote: I have a ComboBox and Below is the code for it. The Code works perfectly as it should; there is absolutely no problems with the code, but here's my quandry... When I use, Private Sub DList_Change() Dim DNum DNum = DList.Value If DNum < "0" Then Range("A" & DNum).Activate End If DList.Value = "0" End Sub It works When I do this.... Private Sub DList_Change() ThisWorkbook.GoToDList End Sub and the code for GoToDList is... Sub GoToDList() Dim DNum DNum = DList.Value If DNum < "0" Then Range("A" & DNum).Activate End If DList.Value = "0" End Sub It doesn't work at all, I keep getting errors to debug. I don't understand; I use the exact same code. Thanks Very Much In Advance, Rob |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
combobox code | Excel Discussion (Misc queries) | |||
combobox code | Excel Discussion (Misc queries) | |||
combobox code | Excel Discussion (Misc queries) | |||
ComboBox code | Excel Worksheet Functions | |||
Code for ComboBox | Excel Programming |