Why does this code not work?? VBA

Xineq

New Member
Joined
Aug 29, 2014
Messages
34
I have some trouble with this Code, and i don't know why it's not working??

Code:
If Sheets("Counting").Cells("R4").Value = "Amount 2014 - 4" Then
        Sheets("Counting").Range("S4:W4").Copy Destination:=Sheets("Overview 2014-4").Cells(Rows.Count, "Q").End(xlUp).Offset(1, 0)
    End If

i get run-time error 5

Hope you can help me out :)
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
.Cells("R4") should be range("R4")

try all your other ranges is they really exist. in immediate window type
Code:
?Sheets("Counting").cells("R4").address
if your range is ok, you'll get address, else you need to fix your syntax
 
Upvote 0
Try

Rich (BB code):
If Sheets("Counting").Range("R4").Value = "Amount 2014 - 4" Then
    Sheets("Counting").Range("S4:W4").Copy Destination:=Sheets("Overview 2014-4").Cells(Rows.Count, "Q").End(xlUp).Offset(1, 0)
End If
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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