Extracting data from one sheet to another on a daily basis

AndyGav86

New Member
Joined
Nov 17, 2022
Messages
33
Office Version
  1. 365
Platform
  1. Windows
I'm looking to try and extract data from one sheet to another, but the first sheet is used daily so the data is overwritten every day. I need it to go into another sheet for each day of the month.

So I need the day total of LAG, ETD & SCANNER to be put into the corresponding table on another sheet for each day if that makes sense?

Many Thanks in advance
 

Attachments

  • Screenshot 2022-11-21 153542.png
    Screenshot 2022-11-21 153542.png
    22.9 KB · Views: 10
  • Screenshot 2022-11-21 153611.png
    Screenshot 2022-11-21 153611.png
    27.3 KB · Views: 11

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
So the format of both sheets remains the same but the data contained changes?
Can i take it that every day you click a button and the macro would pull data from cells D31, D35 and D40?
And then places that data on the row corresponding with the day of the month?

What happens when it's no longer the month you started on? Do you wipe the second sheet manually, or copy the sheet to a different name and start again?
 
Upvote 0
So the format of both sheets remains the same but the data contained changes?
Can i take it that every day you click a button and the macro would pull data from cells D31, D35 and D40?
And then places that data on the row corresponding with the day of the month?

What happens when it's no longer the month you started on? Do you wipe the second sheet manually, or copy the sheet to a different name and start again?
yes, so format is the same I believe, and yes, a button with a macro would be perfect but i have realised a new problem i actually need the percentage of the day for each one so it would be what percentage is D31 from B29 & D35 from B29 & D40 from B29.
Yes, then it would go into the corresponding day of the month in the other sheet
so, at the end of the month the worksheet is saved then I would start a new worksheet for the following month

I hope that makes sense I'm really new at this, so ask me more if you need more info

And thank you for replying to this
 
Upvote 0
i actually need the percentage of the day for each one so it would be what percentage is
D31 from B29 &
D35 from B29 &
D40 from B29.

at the end of the month the worksheet is saved then I would start a new worksheet for the following month

So daily you click a button.
With the 'Lag's - ETD's - Scanner' sheet row X:
Column B = D31/B29
Column C = D35/B29
Column D = D40/B29

Can i take it this destination sheet has the cells formatted as percentages?

Macro
Alt+F11 to open VBA developer.
Insert>Module
Paste in the following.

VBA Code:
Sub collect_lag_etd_scanner_ratios()

Dim strCopySheetName As String, strPasteSheetName As String
Dim lngTodaysRow As Long
Dim tempCalc As Variant

strCopySheetName = "Sheet1"
strPasteSheetName = "Sheet2"

lngTodaysRow = Day(Date) + 11   'the row your date list starts at -1.

    With ThisWorkbook
        Debug.Print lngTodaysRow
        
        tempCalc = Sheets(strCopySheetName).Range("D31").Value2 / Sheets(strCopySheetName).Range("B29").Value2
        Sheets(strPasteSheetName).Range("B" & lngTodaysRow).Value2 = tempCalc
    
        tempCalc = Sheets(strCopySheetName).Range("D35").Value2 / Sheets(strCopySheetName).Range("B29").Value2
        Sheets(strPasteSheetName).Range("C" & lngTodaysRow).Value2 = tempCalc
    
        tempCalc = Sheets(strCopySheetName).Range("D40").Value2 / Sheets(strCopySheetName).Range("B29").Value2
        Sheets(strPasteSheetName).Range("D" & lngTodaysRow).Value2 = tempCalc
    
    End With

End Sub

Create your shape and assign macro
Insert>Shape
paste your shape
left click to give it a title
right click > assign macro
select the macro we made.
left click the shape again to run the macro.
 
Upvote 0
So daily you click a button.
With the 'Lag's - ETD's - Scanner' sheet row X:
Column B = D31/B29
Column C = D35/B29
Column D = D40/B29

Can i take it this destination sheet has the cells formatted as percentages?

Macro
Alt+F11 to open VBA developer.
Insert>Module
Paste in the following.

VBA Code:
Sub collect_lag_etd_scanner_ratios()

Dim strCopySheetName As String, strPasteSheetName As String
Dim lngTodaysRow As Long
Dim tempCalc As Variant

strCopySheetName = "Sheet1"
strPasteSheetName = "Sheet2"

lngTodaysRow = Day(Date) + 11   'the row your date list starts at -1.

    With ThisWorkbook
        Debug.Print lngTodaysRow
       
        tempCalc = Sheets(strCopySheetName).Range("D31").Value2 / Sheets(strCopySheetName).Range("B29").Value2
        Sheets(strPasteSheetName).Range("B" & lngTodaysRow).Value2 = tempCalc
   
        tempCalc = Sheets(strCopySheetName).Range("D35").Value2 / Sheets(strCopySheetName).Range("B29").Value2
        Sheets(strPasteSheetName).Range("C" & lngTodaysRow).Value2 = tempCalc
   
        tempCalc = Sheets(strCopySheetName).Range("D40").Value2 / Sheets(strCopySheetName).Range("B29").Value2
        Sheets(strPasteSheetName).Range("D" & lngTodaysRow).Value2 = tempCalc
   
    End With

End Sub

Create your shape and assign macro
Insert>Shape
paste your shape
left click to give it a title
right click > assign macro
select the macro we made.
left click the shape again to run the macro.
So, I didn't understand a couple of things,
Yes, they are formatted to percentage
The Daily button would be on the sheet named "SDR" and the destination sheet is named "KPI Hidden"
I didn't know what you meant by 'the row your date list starts at -1.
as you can see by the screen shot i think it worked but seemed to go into the day of the 14th?
I'm not sure what I'm doing wrong
 

Attachments

  • Screenshot 2022-11-27 170241.png
    Screenshot 2022-11-27 170241.png
    37.3 KB · Views: 2
Upvote 0
I didn't know what you meant by 'the row your date list starts at -1.
The 'Date' function returns something like 'dd-mm-yyyy' and 'Day()' extracts the day of the month from that.
So Day(Date) should return 28 as today is the 28th (In Australia, at least).
But your list of dates start at row 12.....
So to get your correct row we need to add 11 + 28 to get your correct row.
Which is "'the row your date list starts at -1."

as you can see by the screen shot i think it worked but seemed to go into the day of the 14th?
I'm not sure what I'm doing wrong
Yeah neither do I. Let's troubleshoot it.

Add these two lines of code under 'lngTodaysRow = Day(Date) + 11'
VBA Code:
Debug.Print "Today's date is " & Date
Debug.Print "Today's row is " & lngTodaysRow

If your immediate window is not showing in the editor, open the editor up and press CTRL+G.
You should see this after running the code once (F5):
1669588130297.png


Let us know what your immediate window said.
 
Upvote 0
Solution
I think you've done it !!!!

I'll continue to try it every day till the end of the month then again on the first and let you know.

Thank you so much for your help this has taking me a long time to sort out and I can't thank you enough
 

Attachments

  • Screenshot 2022-11-28 093259.png
    Screenshot 2022-11-28 093259.png
    117.3 KB · Views: 7
Upvote 0
I think you've done it !!!!

I'll continue to try it every day till the end of the month then again on the first and let you know.

Thank you so much for your help this has taking me a long time to sort out and I can't thank you enough

Great!
For the people reading this thread coming from a search engine, would you mind marking the post as a solution so it pops up at the top of the thread?
 
Upvote 0

Forum statistics

Threads
1,214,583
Messages
6,120,383
Members
448,956
Latest member
JPav

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