Copy Column Range in Workbook to Data Worksheet in differnt file

linesy

Board Regular
Joined
Sep 27, 2004
Messages
72
Good morning all,

I have around 30 worksheets (all in the same workbook but not all the sheets in the said workbook) that I need to copy 1 column range (C11:C90) in each of these tabs into a new file (ProdData.xlsm) Sheet "Qtr" at "C11" and then the next subsequent column ("D11, E11" etc.)

I recorded a macro, but it's HUGE and very ugly. Any help would be appreciated.

Thanks and have a wonderful day.

Susan
 

dangelor

Board Regular
Joined
May 6, 2005
Messages
138
Possibly...
Code:
Sub NotTested()
    Dim WBDest As Workbook
    Dim WSDest As Worksheet
    Dim WS As Worksheet
    Dim lCol As Long
    
    Set WBDest = Workbooks("ProdData.xlsm")
    Set WSDest = WB.Worksheets("Qtr")
    
    For Each WS In ThisWorkbook
        if ws = 'CRITERIA FOR COPYING DATA FROM A WORKSHEET' Then
            lCol = WSDest.Cells(11, WSDest.Columns.Count).End(xlLeft).Column
            WS.Range("C11:C90").Copy WSDest.Cells(11, lCol)
        End If
    Next WS
End Sub
 

Forum statistics

Threads
1,081,706
Messages
5,360,763
Members
400,595
Latest member
T_Dubs

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