O
Oligo
Sub MakeATable()
Dim myB2Arr As Range
Dim myB4Arr As Range
Dim myB2 As Range
Dim myB4 As Range
Dim myR As Long
Set myB2Arr = Worksheets("Main Data").Range("A10:A13")
Set myB4Arr = Worksheets("Main Data").Range("A3:A5")
For Each myB2 In myB2Arr
For Each myB4 In myB4Arr
Worksheets("calculation").Range("B2").Value = myB2.Value
Worksheets("calculation").Range("B4").Value = myB4.Value
Application.CalculateFull
myR = Cells(Rows.Count, 1).End(xlUp)(2).Row
Cells(myR, 1).Value = myB2.Value
Cells(myR, 2).Value = myB4.Value
Worksheets("calculation").Range("G9:G13").Copy
Cells(myR, 3).PasteSpecial xlValues, Transpose:=True
Next myB4
Next myB2
End Sub
i have this code currently that tabulate a table on a new sheet. currently
i added a play button to run the macro.
my output G9:G13 is dependent on other inputs cells. my question is how do i
clear the previous table for a next set of input change tabulation? ie. i
only want my table to show current data and not build on from past output.
Dim myB2Arr As Range
Dim myB4Arr As Range
Dim myB2 As Range
Dim myB4 As Range
Dim myR As Long
Set myB2Arr = Worksheets("Main Data").Range("A10:A13")
Set myB4Arr = Worksheets("Main Data").Range("A3:A5")
For Each myB2 In myB2Arr
For Each myB4 In myB4Arr
Worksheets("calculation").Range("B2").Value = myB2.Value
Worksheets("calculation").Range("B4").Value = myB4.Value
Application.CalculateFull
myR = Cells(Rows.Count, 1).End(xlUp)(2).Row
Cells(myR, 1).Value = myB2.Value
Cells(myR, 2).Value = myB4.Value
Worksheets("calculation").Range("G9:G13").Copy
Cells(myR, 3).PasteSpecial xlValues, Transpose:=True
Next myB4
Next myB2
End Sub
i have this code currently that tabulate a table on a new sheet. currently
i added a play button to run the macro.
my output G9:G13 is dependent on other inputs cells. my question is how do i
clear the previous table for a next set of input change tabulation? ie. i
only want my table to show current data and not build on from past output.