How to copy a column from one sheet to another

nehachoubey

Board Regular
Joined
Aug 17, 2011
Messages
52
HI,
I have to copy one column from 3 different sheets to one sheet. Details are:

Copy from: DATA(Column B), SCREEN(Column B), SUMMARY(Column C) sheets
Copy to: LABELS(Column B)

I dont know how many cells will be there in those 3 sheets. Plz reply.
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,651
Try

Code:
Sub test()
Dim LR As Long
LR = Sheets("DATA").Range("B" & Rows.Count).End(xlUp).Row
Sheets("Data").Range("B1:B" & LR).Copy Destination:=Sheets("LABELS").Range("B" & Rows.Count).End(xlUp).Offset(1)
LR = Sheets("SCREEN").Range("B" & Rows.Count).End(xlUp).Row
Sheets("SCREEN").Range("B1:B" & LR).Copy Destination:=Sheets("LABELS").Range("B" & Rows.Count).End(xlUp).Offset(1)
LR = Sheets("SUMMARY").Range("C" & Rows.Count).End(xlUp).Row
Sheets("SUMMARY").Range("C1:C" & LR).Copy Destination:=Sheets("LABELS").Range("B" & Rows.Count).End(xlUp).Offset(1)
End Sub
 

Manohar M G

Board Regular
Joined
Jul 29, 2011
Messages
70
:confused:Hi,

I have some query:

1. The Data which is from column B (data),Column B (Screen) and Column C (Summary). All 3 columns should be display in Column B..? or it should be in different columns..
 

Weaver

Well-known Member
Joined
Sep 10, 2008
Messages
5,196
try

Code:
Sub test()
    Dim a(2) As Variant, r As Range, i As Integer
    a(0) = "Data,b:b"
    a(1) = "screen,b:b"
    a(2) = "summary,c:c"
    For i = 0 To 2
        Set ws = Sheets(Split(a(i), ",")(0))
        Set r = Intersect(ws.UsedRange, ws.Range(Split(a(i), ",")(1)))
        r.Copy Sheets("labels").Cells(Rows.Count, "B").End(xlUp).Offset(1)
    Next i
End Sub
 

Forum statistics

Threads
1,081,623
Messages
5,360,083
Members
400,570
Latest member
Ben Morgan 1985

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