KillGorack
New Member
- Joined
- Jan 23, 2006
- Messages
- 35
- Office Version
- 2016
- Platform
- Windows
Hey,
Previous answer showed this is possible, but tried the code below, but when ran each cell has #VALUE! within.
any ideas?
Previous answer showed this is possible, but tried the code below, but when ran each cell has #VALUE! within.
any ideas?
VBA Code:
Sub populateBindField()
' ===============================================================
' Declarations
' ===============================================================
Dim x As Integer
Dim tempheight As Integer
Dim tempwidth As Integer
Dim r As String
' ===============================================================
' Size it up
' ===============================================================
tempheight = ThisWorkbook.Sheets("raw data").Cells(Rows.Count, 1).End(xlUp).Row
tempwidth = ThisWorkbook.Sheets("raw data").Cells(1, Columns.Count).End(xlToLeft).Column
' ===============================================================
' Subtotals.
' ===============================================================
For x = 21 To tempwidth
r = "SUBTOTAL(9, RANGE(ThisWorkbook.Sheets(" & Chr(34) & "raw data" & Chr(34) & ").cells(2, " & x & "), ThisWorkbook.Sheets(" & Chr(34) & "raw data" & Chr(34) & ").cells(" & tempheight & ", " & x & ")))"
ThisWorkbook.Sheets("output").Cells(36, x - 20).Value = Evaluate(r)
Next x
' ===============================================================
End Sub