Forum Discussion

Rudrabhadra's avatar
Rudrabhadra
Brass Contributor
Oct 26, 2022
Solved

VBA for copying specific cells

Tried a VBA for copying specific cells from each worksheet and appending the data in one worksheet ("Comb") which is working as my requirement. But I understand that the code runs all the worksheet i...
  • OliverScheurich's avatar
    Oct 26, 2022

    Rudrabhadra 

    Sub Copydatamod()
    Dim Sh As Worksheet
    
    For Each Sh In ThisWorkbook.Worksheets
    Select Case Sh.Name
    Case Is = "Comb"
    Case Else
    
    Sh.Range("B7:EA46").Copy
    Sheets("Comb").Activate
    Range("B" & Rows.Count).End(xlUp).Rows.Cells.Offset(2, 0).Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    
    End Select
    Next Sh
    
    End Sub

    Maybe with a SELECT CASE statement.

Resources