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:
Wait. I will record a video and will share it with you.
 
Upvote 0

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Screenshot 2022-09-13 015604.png
 
Upvote 0
Sorry man. I am getting confused as my mind is else somewhere. Got to go now. Already received 2 calls from my office. Will share the correct data once I am back.
 
Upvote 0
Link to Video of extracting Projected sales.
Video of Extract.mp4
Link to workbook which needs a little more of editing.
ClearData all in one button.xlsm
Clear data code to be edited if required as it is a recorded macro. There are no fixed ranges in this code else could have been changed. In the total code the range needs to be changed from 100000 to unlimited. And lastly combine all the codes and assign to one button.
 
Upvote 0

Ok I fixed the error that I was getting

VBA Code:
    ActiveWorkbook.Worksheets("Total").Sort.SortFields.Add2 Key:=Range( _
        "D2:D100000"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
        xlSortNormal

I had to change the 'Add2' part of that line to just 'Add' to make it compatable with my version of excel. ;)

So where are we at now? Making it run with one button? What order do you want the buttons to be ran in?
 
Upvote 0
Extract >Shift amounts >post data to daily >Get total
If you can add the clear old data in the first line of Extract then I need not use 2 buttons.
In the extract sheet you have to delete the data from 7 onwards to end only. The rows from 1-6 in extract , as I noticed are automatically rewritten.
 
Upvote 0
Were you able to edit the code regarding the CR sheet. If CR cell A2 is nullstring then post only Daily entries to Total else combine both entries....
 
Upvote 0
So you want the Clear old data to always run first?
 
Upvote 0

Forum statistics

Threads
1,215,516
Messages
6,125,280
Members
449,220
Latest member
Excel Master

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