General Precautions we can take while operating 2 excel sheets

thesimile

New Member
Joined
Feb 27, 2020
Messages
25
Office Version
  1. 365
Platform
  1. Windows
Hello Gurus,
I am working on an item, where I need to compare 2 excel sheet ranges, Say File1 Sheet1& File2 Sheet1
  1. I am invoking File2 Sheet1 by File.Open
  2. Copying the respective range from file 1 & file 2 into Rng1 & Rng2
  3. I am concatenating column values for each row in Rng1 & Rng2 & putting it in respective sheet
  4. Invoking a Match from File 1 between Rng1 row value & Rng2 values
  5. Copying the Match results (Values only) to another column in Rng1
  6. Invoking a Match from File 1 between Rng2 Row value & Rng1 values
  7. Copying the Match results (Values only) to another column in Rng2
This functionality works most of the time. But sometimes, instead of pasting values from Rng2 in Rng2 columns, it pastes in Rng1. I took the following precautions
  • Made Enable Events false
  • Made Screenupdating False
  • Made Application.Calculation as Manual
  • Did Application.Calculate as and when required.
  • Explicitly used This.Workbook, while referring to Rng1 & specified exact path for Rng2 as well.
  • Made all settings opposite once program ended (like setting screenupdating to true)

Are there any other precautions that I can take to prevent such anomalous behavior ?

Thanks.
Arun
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
After the File2.Open, when I use command 'Windows(L_Fl).ActivatePrevious' or ThisWorkbook.Activate, , to bring forward my file1, then this issue of Rng2 getting copied in Rng1 does not happen. But I dont see any relation between this & the outcome .That is puzzling.
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,205
Members
452,618
Latest member
Tam84

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