Summary Worksheet - Post Data down column, not across row

Iceshade

Board Regular
Joined
May 22, 2017
Messages
104
Office Version
  1. 365
Platform
  1. Windows
Hi Guys,

Very new to VBA and barely know what I am doing so all help is appreciated !

I have created a summary sheet which gets data from multiple worksheets. when the data comes across to the summary sheet, it is populating across the row and I just can't get it to populate down the column instead.

Here is my code so far (I am sure it's super messy and could be streamlined but it works...almost")
Code:
Sub Summary_All_Worksheets_With_Formulas()
    Dim Sh As Worksheet
    Dim Req As Worksheet
    Dim myCell As Range
    Dim ColNum As Integer
    Dim RwNum As Long
    Dim Basebook As Workbook
    With Application
        .Calculation = xlCalculationManual
        .ScreenUpdating = False
    End With
   
    'Add a worksheet with the name "Requirements Gathering"
    Set Basebook = ThisWorkbook
    Set Req = Worksheets("Requirements Gathering")
    
    'The links to the first sheet will start in row 12
    RwNum = 11
    For Each Sh In Basebook.Worksheets
        If Sh.Name <> Req.Name And Sh.Visible Then
            ColNum = 1
            RwNum = RwNum + 1
            'Copy the sheet name in the A column
            Req.Cells(RwNum, 2).Value = Sh.Name
            For Each myCell In Sh.Range("B9,H10:H20") '<--Change the range
                ColNum = ColNum + 1
                Req.Cells(RwNum, ColNum).Formula = _
                "='" & Sh.Name & "'!" & myCell.Address(False, False)
            Next myCell
        End If
    Next Sh
    Req.UsedRange.Columns.AutoFit
    With Application
        .Calculation = xlCalculationAutomatic
        .ScreenUpdating = True
    End With
End Sub

Any ideas? My brain hurts :eeek:
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Just tweaking yours a little:

Code:
Sub Summary_All_Worksheets_With_Formulas()
    Dim Sh As Worksheet
    Dim Req As Worksheet
    Dim myCell As Range
    Dim ColNum As Integer
    Dim RwNum As Long
    Dim Basebook As Workbook
    With Application
        .Calculation = xlCalculationManual
        .ScreenUpdating = False
    End With
   
    'Add a worksheet with the name "Requirements Gathering"
    Set Basebook = ThisWorkbook
    Set Req = Worksheets("Requirements Gathering")
    
    'The links to the first sheet will start in row 12
    ColNum = 1
    
    For Each Sh In Basebook.Worksheets
        If Sh.Name <> Req.Name And Sh.Visible Then
            RwNum = 11
            ColNum = ColNum + 1
            'Copy the sheet name in the A column
            Req.Cells(RwNum, ColNum).Value = Sh.Name
            For Each myCell In Sh.Range("B9,H10:H20") '<--Change the range
                RwNum = RwNum + 1
                Req.Cells(RwNum, ColNum).Formula = _
                "='" & Sh.Name & "'!" & myCell.Address(False, False)
            Next myCell
        End If
    Next Sh
    
    Req.UsedRange.Columns.AutoFit
    With Application
        .Calculation = xlCalculationAutomatic
        .ScreenUpdating = True
    End With
    
End Sub
 
Upvote 0
Hi Steve ! Thanks a bunch ! - can't believe it was as easy as adding in the ColNum variable (don't know why I didn't think of that) thanks again !
 
Upvote 0

Forum statistics

Threads
1,223,249
Messages
6,171,031
Members
452,374
Latest member
keccles

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