Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 271
Default Trouble with VB since adding a macro

I added a macro to a form I created so that users would tab through the cells
in numerical order. After running the macro, I tested the form to ensure
that it was still working correctly. There are checkmark boxes in the
worksheet that are programmed with visual basic to transfer the data from
each row that users select to another sheet within the same workbook. Since
adding the macro, when I click a checkmark box, I get the error message:
"Compile error: Sub or Function not defined." I click OK and then it takes
me to my VB programming:

Private Sub CheckBox5_Change() (This is highlighted in yellow)
Call startstop (This is selected with blue)

If I leave VB open, the form works the way it was intended to. If I close
VB, I get a message that says "This will stop the debugger" and then the
worksheet doesn't work correctly. The macro I added is:

Sub AutoOpen()
Range("D1,D2,D3,D4,D5,F1,F2,F3,F4,F5,N1").Select
Range("D1").Activate
End Sub

Sub AutoOpen() is highlighted in yellow, since trying to use the checkmark
boxes.

Is there another step I need to do, or does this macro need to be inserted
into my VB code somewhere.

Susan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Trouble with VB since adding a macro

The error seems to be telling you that the Sub named "startstop" is not
defined (cannot be found). When you leave VB open it is still "stopped" on
the error message (in debug mode), so all execution is suspended. When you
close it it takes you out of debug mode.

The code you show looks OK, the problem seems to be with startstop. Where
is this sub located - is it in one of the worksheet modules or did you add a
code module? Did you declare it as a Public Sub? If it is in a different
module from the one where CheckBox5_Change() is located, and is not declared
Public, VBA will not be able to find it when CheckBox5 calls it.
--
- K Dales


"Susan" wrote:

I added a macro to a form I created so that users would tab through the cells
in numerical order. After running the macro, I tested the form to ensure
that it was still working correctly. There are checkmark boxes in the
worksheet that are programmed with visual basic to transfer the data from
each row that users select to another sheet within the same workbook. Since
adding the macro, when I click a checkmark box, I get the error message:
"Compile error: Sub or Function not defined." I click OK and then it takes
me to my VB programming:

Private Sub CheckBox5_Change() (This is highlighted in yellow)
Call startstop (This is selected with blue)

If I leave VB open, the form works the way it was intended to. If I close
VB, I get a message that says "This will stop the debugger" and then the
worksheet doesn't work correctly. The macro I added is:

Sub AutoOpen()
Range("D1,D2,D3,D4,D5,F1,F2,F3,F4,F5,N1").Select
Range("D1").Activate
End Sub

Sub AutoOpen() is highlighted in yellow, since trying to use the checkmark
boxes.

Is there another step I need to do, or does this macro need to be inserted
into my VB code somewhere.

Susan

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble adding timesheet formulas Leo Excel Worksheet Functions 1 December 28th 09 09:56 PM
trouble adding addins jc Excel Discussion (Misc queries) 0 December 23rd 09 12:15 AM
trouble adding addins jc Excel Discussion (Misc queries) 0 December 23rd 09 12:13 AM
trouble adding to list. jeramie[_2_] Excel Programming 2 March 13th 06 08:31 AM
I am having trouble adding a row in Excel. What am i doing wrong? Glendie Excel Worksheet Functions 1 May 28th 05 08:37 PM


All times are GMT +1. The time now is 08:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"