Closed Thread
Results 1 to 2 of 2

Object Required - Error 424

  1. #1
    Registered User
    Join Date
    10-22-2014
    Location
    Ashgabat, Turkmenistan
    MS-Off Ver
    MS OFFICE 2010
    Posts
    6

    Object Required - Error 424

    test.xlsmHi there,

    The goal of the macro is to copy a named range(table) from one sheet to a specific place in another sheet within the same workbook. The destination cell is bounded by some other text. Here is a sample layout (sample file also attached):

    Some text

    ***Copied table***

    Some text

    The copied table can be of variable size and the "Some text" should wrap that table.

    I came up with the code below but there is a problem when the following line is executed

    ActiveSheet.Range(cel, cel.Offset(RowDiff - 2, 0)).EntireRow.Select ''Does not work here - Error 424 - Object required

    However, if I uncomment the following line in the code it works fine

    ' ActiveSheet.Range(cel, cel.Offset(RowDiff - 2, 0)).EntireRow.Select ''Works here

    Below is the full macro code:

    Option Explicit

    Dim RowDiff As Integer
    Dim ra As String
    Dim cel As Range

    Private Sub Worksheet_Change(ByVal Target As Range)

    Set cel = Worksheets("Sheet2").Range("A8")

    If Not Intersect(Target, Range("DB")) Is Nothing Then

    RowDiff = 0
    Do While cel.Offset(RowDiff, 0).Value <> "End"
    RowDiff = RowDiff + 1
    If RowDiff > 10000 Then Exit Do
    Loop
    End If
    ' MsgBox RowDiff
    If RowDiff >= 1 Then
    Worksheets("Sheet2").Activate
    ActiveSheet.Range(cel, cel.Offset(RowDiff - 2, 0)).EntireRow.Delete Shift:=xlShiftUp
    ' ActiveSheet.Range(cel, cel.Offset(RowDiff - 2, 0)).EntireRow.Select ''Works here
    Range("DB").Copy
    Worksheets("Sheet2").Activate
    ActiveSheet.Range("A8").Select
    Selection.Insert Shift:=xlDown
    'Application.CutCopyMode = False
    'ra = "A8:A" & RowDiff + 8 - ulgy workaround
    'Worksheets(2).Range(ra).EntireRow.AutoFit - ugly workaround
    ActiveSheet.Range(cel, cel.Offset(RowDiff - 2, 0)).EntireRow.Select '' Does not work here - Error 424 - Object required
    Else: End

    ' ra = Range("DB").Cells(1, 1).Address(False, False)
    ' Range("DB").Copy Destination:=Worksheets("Sheet2").Range("ra")

    End If

    End Sub


    I had to use the "ugly workaround", which is commented out in a code, to make the macro work and it does what I want but I still do not understand why I get that "Object required" error.

    Any help would be appreciated.

    Thank you in advance,
    Merdan

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,592

    Re: Object Required - Error 424

    Welcome to the Forum, unfortunately:

    This is a duplicate post and as such does not comply with Rule 5 of our forum rules. This thread will now be closed, you may continue in your other thread.
    http://www.excelforum.com/excel-prog...ror-424-a.html
    Thread Closed.

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Simple Calendar pop up macro --> error Run-time error '424': Object required
    By am_hawk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-11-2013, 10:38 AM
  2. Object Required error
    By Eduard in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 04-01-2013, 02:27 AM
  3. error object required
    By anavakom in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-25-2013, 11:22 AM
  4. Name.Object (Error Object Required)
    By dssrun209 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-12-2010, 01:38 PM
  5. Error 424 Object Required Error when Using AddItem to ListBox Generated in Code
    By jclark419 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-01-2010, 12:47 PM

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