Run-time error 1004 method range of object worksheet railed

bdough27

New Member
Joined
Nov 15, 2024
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello All,
New to this forum as well as VBA, so i would appreciate some insight. This is probably a simple fix, but i am not able to solve the issue. I have received the following error for the code in the module i am building.
I have tried simple fixes ( adding and removing paste, changing the range values), but to no solution. Any help would be appreciated.

1731679373093.png

1731679399030.png

VBA Code:
Option Explicit
Sub Copy_Paste_Below_Last_Cell()

Dim wbDest As Workbook
Dim wsCopy As Worksheet
Dim wsDest As Worksheet
Dim lDestLastRow As Long
Dim range1 As Range, range2 As Range, range3 As Range, range4 As Range, multipleRange As Range
  
    Application.EnableEvents = False
          Set wsCopy = ThisWorkbook.Sheets("Status Board")
          Set wbDest = Workbooks.Open("\\LT-MAIN-SRV\public\QUALITY\Status Board\DailyPassdownRecordByShift\DailyLogCompletion.xlsx")
          Set wsDest = Worksheets("Log")

          Set multipleRange = wsCopy.Range("Area_1,O2,P2,Q2")
        
                lDestLastRow = wsDest.Cells(wsDest.Rows.Count, "A").End(xlUp).Offset(1).Row


                multipleRange.Copy _
                  wsDest.Range(lDestLastRow)
                wbDest.Close
          
    Application.EnableEvents = True
End Sub
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
That's because you're trying to copy non-adjacent range selections. Try splitting the operation so that you copy your ranges individually. Note that in some cases copying non-adjacent range selections is allowed, as per the following...


Hope this helps!
 
Upvote 0
Welcome to the Board!

Another big issue, is that what you are trying to copy to is NOT a valid range object:
Rich (BB code):
multipleRange.Copy _
    wsDest.Range(lDestLastRow)

1. You have a workbook reference with no worksheet reference.
2. "lDestLastRow" is just a row number, not a valid range address!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,173
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top