How do I change the range in this code.

RAJESH1960

Banned for repeated rules violations
Joined
Mar 26, 2020
Messages
2,313
Office Version
  1. 2019
Platform
  1. Windows
'for' Loop @Fluff need your help to edit this..
This code was shared by Fluff last year which worked correctly in the previous project. At first the data extracted was filled in around 600 rows but when the value of the amount to be extracted has increased, it is not possible to get the data in 600 rows. Hence the formulas in rows after the 600th row have been shifted to the top so that I can get unlimited rows to fill the data.
If the number of rows is avoided and changed to unlimited rows it will be really helpful in future.
I am trying this code by changing the range in the code by editing it. But I am getting a run time error 1004 at this line. Can someone please help me to correct it.? I want to add this code at the end of the existing code.
Rich (BB code):
         Cells(2000, .Offset(, -14).Column).End(xlUp).Offset(1).Resize(2).Value = .Offset(.Count - 2).Resize(2).Value
Link to the file is below
Shift amounts.xlsm
 
Last edited:
That is the code name for the sheet name 'Extract'.
 
Upvote 0

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
I tried to call all the modules in extract code and I am getting the same compile error as before.
expected variable or procedure, not module.
 
Upvote 0
It is time to grab some sleep now. Hope to see the single button running in the morning. Good Night JohnnyL.
 
Upvote 0
No problem, Easiest way is to combine all the modules into one module. Then your dilemma would be solved.
 
Upvote 0
Or in its current form you would use something like:
VBA Code:
Call ModuleName.ModuleSubroutineName

Example:
VBA Code:
Call BShiftAmounts.ShiftAmounts
Call CCopy_To_Daily.Copy_To_Daily
Call Get_Total.Get_Total
 
Upvote 0
At first I thought when I press each button it is clearing the old data in the extract sheet. Then it is extracting the new data. But I was wrong here again. I have created a clear data button to clear the old data. Please alter this code especially the range or you can clear the data in each module first and then extract, etc., the data.
I also tried the call method to combine all the modules but it is not working.
 
Upvote 0
Did you try the code in post #35? it is fool proof.
 
Upvote 0
Yes. I tried in 2 different ways. Entered all the 3 lines in the end of Extract module - did not work.
entered individual lines in each module at the end - that too it did not work.
 
Upvote 0

Forum statistics

Threads
1,216,087
Messages
6,128,740
Members
449,466
Latest member
Peter Juhnke

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