Three spreadsheets to become one

vintage36

Board Regular
Joined
Nov 29, 2011
Messages
56
I keep records of electricity, gas and water consumption, which at the moment are on individual spreadsheets. I want to create a functioning spreadsheet of three original sheets to contain those I first mentioned.

Copy and paste seems not to work, as each new item posted to the recipient sheet appears to remove the previous one. (?)

How should I go about this, please?
 

PCL

Well-known Member
Joined
Jul 15, 2008
Messages
1,343
Is the data layout the same in each worksheet ... : Same Header ?
 

PCL

Well-known Member
Joined
Jul 15, 2008
Messages
1,343
Perhaps next code
Code:
Option Explicit


Sub CompilData()
Const DstWsN = "Review"
Const OrgWsLst = "Data1,Data2,Data3"
Dim WsN
    For Each WsN In Split(OrgWsLst, ",")
        With Sheets(WsN)
            .UsedRange.Offset(1, 0).Copy Destination:=Sheets(DstWsN).Cells(Rows.Count, 1).End(3)(2)
        End With
    Next WsN
End Sub
Adjust Const DstWsN = "Review"
Code:
Const OrgWsLst = "Data1,Data2,Data3"
to your need
 
Last edited:

vintage36

Board Regular
Joined
Nov 29, 2011
Messages
56
Is the data layout the same in each worksheet ... : Same Header ?
The worksheets do not have headers.
The layouts will differ, because the information required for each is slightly different. The column names will vary as well.
 

vintage36

Board Regular
Joined
Nov 29, 2011
Messages
56
Also the code entries are not understood. What does each line mean or do, please? What goes in for Data1, Data2, Data3?
 

PCL

Well-known Member
Joined
Jul 15, 2008
Messages
1,343
Data1, Data2, Data3
is the name of the input sheets and you have to custom them with yours names.
The layouts will differ, because the information required for each is slightly different. The column names will vary as well.

Without more information it is not possible to prepare a macro

The worksheets do not have headers.
So how to align the data ???

 
Last edited:

PCL

Well-known Member
Joined
Jul 15, 2008
Messages
1,343
You are the one with the Pb ...!
We can wait.
 

Forum statistics

Threads
1,081,556
Messages
5,359,555
Members
400,533
Latest member
fpenning

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top