Move cells to archive

effka

New Member
Joined
Mar 31, 2022
Messages
19
Office Version
  1. 2021
Platform
  1. Windows
Hello, can you help me, to make macro code for this situation:

I have generated a daily data file ("Data" workbook). Using macro commands, I transfer that data to the "Statistics" workbook, "Uploads" sheet for calculations. Since the data is for one day and I calculating statistics for the whole month, I have to upload that data to the "Statistics" workbook every day. For this situation, I created a “Archive” sheet in the "Statistics" workbook, that gathers all the daily data in one place (for now, I copy paste all data manually). So, the question is:
1. How to move uploaded data (from "Data" workbook to "Statistics" workbook) to “Archive” sheet automatically by one button touch? (for example: I upload day No. 1 data (data table range is for example A1: G300, the number of columns never changes, only the rows change), I press the button, and all data (all data below the range A1: G1 - table headers range) are transferred to the "Archive" sheet second row and below (first row is for table headers). Next day, upload day No. 2 data and again, by pressing the button, I transfer the data to the "Archive" sheet, only for this time day No. 2 data goes after day no. 1 data, and so on whit other days).

I hope I wrote the meaning understandably :)
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Can you upload a representative workbook to DropBox or Box.Com so we could better understand what you want to do and therefore give you some help?

Post back here a link to the location you upload to.
 
Upvote 0
Here you go, created a link of .zip file with all explanations :)

LINK

I need to move only those cells, whose are belove range A10:V10
 
Upvote 0
Try:
VBA Code:
Sub ImportCurrentMonthData()
    Dim targetWorkbook As Workbook, wb As Workbook, Ret As Variant
    Set targetWorkbook = Application.ActiveWorkbook 'ThisWorkbook?
    Caption = "Please Select an input file "
    Ret = Application.GetOpenFilename(, , Caption)
    If Ret = False Then Exit Sub
    Set wb = Workbooks.Open(Ret)
    wb.Sheets(1).UsedRange.Offset(1).Copy targetWorkbook.Sheets("Archive").Cells(targetWorkbook.Sheets("Archive").Rows.Count, "A").End(xlUp).Offset(1)
    wb.Close False
End Sub
 
Upvote 0
Solution
Try:
VBA Code:
Sub ImportCurrentMonthData()
    Dim targetWorkbook As Workbook, wb As Workbook, Ret As Variant
    Set targetWorkbook = Application.ActiveWorkbook 'ThisWorkbook?
    Caption = "Please Select an input file "
    Ret = Application.GetOpenFilename(, , Caption)
    If Ret = False Then Exit Sub
    Set wb = Workbooks.Open(Ret)
    wb.Sheets(1).UsedRange.Offset(1).Copy targetWorkbook.Sheets("Archive").Cells(targetWorkbook.Sheets("Archive").Rows.Count, "A").End(xlUp).Offset(1)
    wb.Close False
End Sub
Thank you, your provided solution is much more better. That macro instantly puts data to Archive sheet :)
 
Upvote 0
You are very welcome. :)
 
Upvote 0

Forum statistics

Threads
1,214,598
Messages
6,120,441
Members
448,966
Latest member
DannyC96

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