Copy and Paste to a non-active sheet using vba
Hi to All,
When I run the macro below from sheet("Weekly Total") it create the following error:
Run time error 1004: Application - Defined or Object -defined error
When I run the macro from sheet("Sheet1") it works fine
'Copy Weekly Call Count Data
Worksheets("Sheet1").Range(Cells(4, 12), Cells(15, DatePart("ww", Date, vbSunday))) = _
'Copy Weekly Percent data
Worksheets("Sheet1").Range(Cells(21, 12), Cells(31, DatePart("ww", Date, vbSunday))) = _
I would appreciate any help
Thanks in advance
Anwsers to the Problem Copy and Paste to a non-active sheet using vba
If you define a range like this:
Worksheets("Sheet1").Range(Cells(4, 12), Cells(15, DatePart("ww", Date, vbSunday)))
The "Cells()" part will allways reference the active sheet, and not necessarily Sheet1. You get an error because (when sheet1 isn't active) the "Cells()" parts define a range not on sheet1.
This should work:
.Range(.Cells(4, 12), .Cells(15, DatePart("ww", Date, vbSunday))) .value= _
Note the dot before "cells()" links it to Sheet1 and not the active sheet.
Note: It is recommended that you back up your files and folders before attempting this step:
- Move the mouse cursor over to the upper right side of the screen.
- A menu will pop up on the left. Click on the "Settings" feature on the menu.
- On the Settings window, click on the "Change PC settings."
- Now, left click on the "Update and recovery" feature.
- For the next step, left click on the "Recovery" feature.
- There is an option here saying "Refresh your PC without affecting your files." There, left click on the "Get started" button.
- Now, follow the instructions on the screen to finish the Refresh process.
- After the Refresh process has finished restart your Windows 8.1 or Windows 8 device.
- Check again to see if the error Copy and Paste to a non-active sheet using vba has been fixed.
If you do not possess the technical expertise required to accomplish this yourself or do not feel comfortable doing so, download and install a powerful automated tool to get the job done.
Another Safe way to Repair the Problem: Copy and Paste to a non-active sheet using vba:
How to Fix Copy and Paste to a non-active sheet using vba with SmartPCFixer?
1. Download SmartPCFixer. Install it on your system.
2. After the scan is done, you can see the errors and problems which need to be repaired.
3. When the Fixing part is done, your computer has been speeded up and the errors have been removed
Related: How Can You Update & Download NVidia 6100, 6800 GS/XT Display Driver v.260.89 WHQL,Where to Download NVidia GeForce 8800 GT WHQL-certified driver v.196.21,How to Update & Download NVidia GeForce Go 7400 Display Driver v.260.19.12,[Solved] Download NVidia GeForce GTX 460M Driver v.331.82,Download NVidia Quadro Plex Model IV VGA Driver v.304.43 Certified,Way to Download RealTek RTL8100C(L) Driver v.5.01,Way to Download RealTek RTL8100E Drivers v.694,Way to Update & Download RealTek RTL8101L Auto Installation Program v.6.110 driver,Method to Update & Download RealTek RTL8111G PXE and RPL ROM code v.2.58 driver,How to Update & Download RealTek RTL8411B(N) Driver v.10.003,Best Way to Update & Download ASUS A53SV nVidia Graphics Driver v.22.214.171.12486,Method to Herunterladen ASUS K75VJ Intel Rapid Storage Technology Treiber v.126.96.36.1990,How Can You Update & Download ASUS CG8580 Intel Chipset Driver v.188.8.131.529,Method to Update & Download ASUS K41VD Intel INF Update Driver v.184.108.40.2065,Way to Update & Download ASUS Pro70T NB Probe v.3.0.0026 driver
Read More: Solution to Error: crashing and restarting windows explorer,Troubleshooting:Could someone tell me again where to find the Microsoft Fix-it tool?,How to Fix Problem - cross scripting error - When I play Pogo Scrabble I get locked out with a cross scripting error?,Corrupt Windows 7 user profile following forced shut down,Could not find the main class: Unpack 200, program will exit. [Anwsered],Closing Internet Explorer causes error,Compare 2 Tables and Calculate the PROFIT Faster,Computer goes to Windows Boot Manager after Start,Connect to one of my network computer remotely when don't allow exception box Marked,computer locking up randomly