Results 1 to 5 of 5

Thread: Run Time Error 1004

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2010
    Posts
    2

    Run Time Error 1004

    I have a user getting a run time error from the following code, but I can't see how - any suggestions?

    Private Sub buttonViewPatient_Click()
    Application.ScreenUpdating = True
    ActiveWindow.DisplayWorkbookTabs = True
    Sheets("data").Select
    End Sub

  2. #2
    Addicted Member
    Join Date
    Jan 2009
    Posts
    233

    Re: Run Time Error 1004

    hi, dseaforduk.. looks like the code you posted is okay..so i suppose the error is not coming from that code..
    The taller the bamboo grows the lower it bends...

  3. #3
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Run Time Error 1004

    Welcome to the forums dseaforduk

    You will get that error if Sheets("data") is hidden. Change your code to this...

    Code:
    Private Sub buttonViewPatient_Click()
        Application.ScreenUpdating = True
        Sheets("data").Visible = True
        Sheets("data").Activate
    End Sub
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  4. #4

    Thread Starter
    New Member
    Join Date
    Jun 2010
    Posts
    2

    Re: Run Time Error 1004

    Thanks for the feedback

    The sheet is not hidden, tab names are, I will try Activate rather than Select.

  5. #5
    Junior Member
    Join Date
    May 2010
    Posts
    19

    Re: Run Time Error 1004

    Use debugger to find error. When error show click debug and press F8 to make step in. Or toggle breakpoint in ur vba code and do f8 and check what data is setted to variable. Always u can use Error Handlers.

Posting Permissions

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



Click Here to Expand Forum to Full Width