+ Reply to Thread
Results 1 to 4 of 4

Getting error running macro

Hybrid View

  1. #1
    Registered User
    Join Date
    01-22-2009
    Location
    Brentwood, California
    MS-Off Ver
    Excel 2003
    Posts
    2

    Getting error running macro

    Hi,
    I am trying to get the UFBT macro in this spreadsheet to work, but when I try to run it I get an error that says "Compile Error: Variable not defined," and when I hit OK, "Sub UFBT" in my Visual BAsic Editor window is highlighted in yellow.
    This macro is supposed to hide eligible rows and columns on two different tabs when run using the macro button in cell J1 on the max store allocation tab

    Thank you!
    -jrenlmar
    Attached Files Attached Files

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Getting error running macro

    Declare your variable types, eg

    Dim wbUFBT As Workbook
    Dim wsUFBT1 As Worksheet, wsUFBT2 As Worksheet
    You also have a typo

    pplication.ScreenUpdating = False
    should obviously be

    Application.ScreenUpdating = False
    I've not verified the accuracy of the code itself.

  3. #3
    Valued Forum Contributor Shijesh Kumar's Avatar
    Join Date
    05-26-2008
    Location
    Bangalore / India
    MS-Off Ver
    2000
    Posts
    717

    Re: Getting error running macro

    U need to define the variable before you can use them

    add the below lines the the begnning for the procedure



    Dim wbUFBT  As Workbook
    Dim wsufbt1 As Worksheet
    Dim wsUFBT2 As Worksheet

    Alternatively u can remove Option Explicit at the top... (Thats considered as bad programming :-))

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Getting error running macro

    Welcome to the forum, jrenlmar.

    Please read the forum rules about thread titles before posting again.
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1