Copying data from one spreadsheet to another

shadows200354

New Member
Joined
Feb 16, 2016
Messages
11
Hi,
I did look for someone to help me copy data from one spreadsheet to another. There is a slight catch, the data original source changes name and file path every month however the destination doesn't (if that makes things easier).

What i need you guys expertise is to copy data from original source and paste values and and format into the new static spreadsheet, from all the tabs in the orignal docs about 12 to 13 tabs (if its easier I will button activate them). the cells the data is picked up from needs to correspond to the ones where the data is dumped effectively as I have another macro that need to be run once the data is moved. (in the static document the macro just reformat the data) in case you need to see the macro I will paste the code below.


This was a simple code that i used the record function to get the vba and adapt it to use with the button click function. (i am pretty novice when it comes to vba coding)

Code:
Sub Button2_Click()'
' Macro2 Macro
'
' Keyboard Shortcut: Ctrl+m
'
    Columns("H:H").Select
    Selection.Copy
    Columns("I:I").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Columns("I:I").EntireColumn.AutoFit
    Columns("U:U").Select
    Application.CutCopyMode = False
    Selection.Copy
    Columns("H:H").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("U6:Z28").Select
    Application.CutCopyMode = False
    Selection.ClearContents
    Columns("U:X").Select
    Selection.ClearContents
    Selection.Delete Shift:=xlToLeft
    Columns("C:C").Select
    Selection.Copy
    Columns("K:K").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
        SkipBlanks:=False, Transpose:=False
    Columns("D:D").Select
    Application.CutCopyMode = False
    Selection.Copy
    Columns("J:J").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Columns("I:I").EntireColumn.AutoFit
    Columns("B:F").Select
    Application.CutCopyMode = False
    Selection.ClearContents


End Sub
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Hi All, thank you for looking at this problem. Just an FYI I have found a solution to my problem, I thought laterally and re-designed the spreadsheet. used this code :)crash:code not written by me:oops:) but if someone wants the solve the issue still i would be forever grateful if not then I am grateful for them to having read the issue in the first place. code I used was,

Code:
'Assuming no current buttons existDim sh1 As Worksheet, sh2 As Worksheet, lr As Long
Set sh1 = Sheets("formatting sheet")
Set sh2 = Sheets("Social Media")
lr = sh2.Cells(Rows.Count, 1).End(xlUp).Row
sh2.Range("A4:V" & lr).Copy sh1.Cells(Rows.Count, 1).End(xlUp)(2)
sh1.Cells(Rows.Count, "X").End(xlUp).Resize(lr - 2, 3).FillDown

I will tweak it so it more suited by thats the general code.

thank you all
 
Upvote 0

Forum statistics

Threads
1,215,465
Messages
6,124,973
Members
449,200
Latest member
Jamil ahmed

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