+ Reply to Thread
Results 1 to 13 of 13

Excel vba function asking for object required error 424

Hybrid View

  1. #1
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,901

    Re: Excel vba function asking for object required error 424

    First: have you changed
    Set c2 = 32000
    into
    c2 = 32000
    As c2 is declared as Integer (it would be wiser to declare it as long) it cannot be Set. You can Set only object variables.

    so:
    Public Function Main_HideRows(ByVal rng As Range, tgbtn As ToggleButton)
    
    Dim sht As Excel.Worksheet
    Dim c As Integer
    Dim c2 As Integer
    
    Set sht = Arkusz1
    'Set
    c2 = 32000
    '...
    if it does not help, press Debug when code stops, chech which code line is highlited in yellow and let us know.

  2. #2
    Registered User
    Join Date
    12-12-2013
    Location
    london, uk
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Excel vba function asking for object required error 424

    Quote Originally Posted by Kaper View Post
    First: have you changed
    Set c2 = 32000
    into
    c2 = 32000
    As c2 is declared as Integer (it would be wiser to declare it as long) it cannot be Set. You can Set only object variables.

    so:
    Public Function Main_HideRows(ByVal rng As Range, tgbtn As ToggleButton)
    
    Dim sht As Excel.Worksheet
    Dim c As Integer
    Dim c2 As Integer
    
    Set sht = Arkusz1
    'Set
    c2 = 32000
    '...
    if it does not help, press Debug when code stops, chech which code line is highlited in yellow and let us know.

    I have made this change. However, I want to turn my sub routine into a function so that I can then reuse it for the other toggle buttons by just passing through the named range and toggle button name.

    However, when I try to call it, it says object required.

    Any suggestions ?

    Bilal

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Run time error 424: Object Required in Outlook/Excel VBA
    By sirhacksalot in forum Excel General
    Replies: 9
    Last Post: 12-07-2013, 11:09 AM
  2. Excel VBA Error Code 424 Object Required
    By jeskit in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-14-2011, 08:27 AM
  3. Object Required Error in VB Excel Program that Passes Range to a function
    By navs8603 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-06-2011, 05:10 AM
  4. Object Required error on Application.Match function.
    By ctckark1 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 06-12-2011, 11:01 AM
  5. Excel 2007 Unable to .pastespecial, Error 'object required'
    By CMSS in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-09-2010, 10:34 AM

Tags for this Thread

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