+ Reply to Thread
Results 1 to 3 of 3

VBA pop up appears since I insert a row in a document

  1. #1
    Registered User
    Join Date
    03-11-2015
    Location
    slovenia
    MS-Off Ver
    MS Office for Mac 2016
    Posts
    20

    VBA pop up appears since I insert a row in a document

    I have 14 rows times’ 31 columns and in each cell there is a check box. There is a control button with an assigned macro in front of every row that allows you to check all the boxes in the entire row. There is also one control button that clears all checked boxes and make them unchecked. All worked fine until I inserted four rows also with checkboxes, but without any macros. Since then every time I want to use control button with macro to check entire row, VBA pop up window appears:
    Run-time error `1004`:
    Method `Range` of object`_Global` failed

    If then I click “End” the macro operation executes as normal and pop up disappears
    And if I click “Debug” VBA opens and there is line yellow marked: “Set row_num = Range(cb.LinkedCell)”

    Please help me

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: VBA pop up appears since I insert a row in a document

    Hi,

    The error message is telling you that at least one of the check boxes (I'm assuming that the VB ref 'cb' means checkbox) isn't linked to a cell and hence the Range instruction has nothing to work with.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    03-11-2015
    Location
    slovenia
    MS-Off Ver
    MS Office for Mac 2016
    Posts
    20

    Re: VBA pop up appears since I insert a row in a document

    Thanks Richard. I think the macro should be rephrased then. Can you help me out?

    Sub checkme(rownum As Long)

    Dim cb As CheckBox
    Dim row_num As Range

    Application.ScreenUpdating = False
    For Each cb In ActiveSheet.CheckBoxes
    Set row_num = Range(cb.LinkedCell)
    If row_num.Row = rownum Then cb.Value = True
    Next cb
    Application.ScreenUpdating = True
    End Sub
    Sub chkrw36()
    checkme (36)
    End Sub
    Sub chkrw37()
    checkme (37)
    End Sub
    Sub chkrw38()
    checkme (38)
    End Sub
    Sub chkrw39()
    checkme (39)
    End Sub
    Sub chkrw40()
    checkme (40)
    End Sub
    Sub chkrw41()
    checkme (41)
    End Sub
    Sub chkrw42()
    checkme (42)
    End Sub
    Sub chkrw43()
    checkme (43)
    End Sub
    Sub chkrw44()
    checkme (44)
    End Sub
    Sub chkrw45()
    checkme (45)
    End Sub
    Sub chkrw46()
    checkme (46)
    End Sub
    Sub chkrw47()
    checkme (47)
    End Sub
    Sub chkrw48()
    checkme (48)
    End Sub
    Sub chkrw51()
    checkme (51)
    End Sub
    Sub uncheckme()

    Dim cb As CheckBox
    Dim row_num As Range
    Application.ScreenUpdating = False
    For Each cb In ActiveSheet.CheckBoxes
    cb.Value = False
    Next cb
    Application.ScreenUpdating = True
    End Sub

+ 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] Cannot insert a row in what appears to be a table in a worksheet
    By PH-Texas in forum Excel General
    Replies: 1
    Last Post: 08-01-2013, 02:29 PM
  2. [SOLVED] Insert value if specific word appears in that row
    By djfscouse in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 10-15-2012, 02:04 PM
  3. Box appears over text in a PDF document converted
    By starbwoy in forum Excel General
    Replies: 0
    Last Post: 04-17-2008, 04:13 PM
  4. Replies: 0
    Last Post: 03-22-2006, 11:30 AM
  5. i push the fx and stupid insert funtion box appears
    By patrick in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-06-2005, 04:06 PM

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