M
meghantrus
need to grab data from a pivot table on a worksheet in the same
workbook
and display it in cells on a different worksheet. (keeping the data
static)
This data needs to stay in a specific cell for that day and then it
will be updated with the new numbers in the cell next to it on the
following day.
Currently I am coding this way with If stmts, but would like to use
flags to do this
so static dates do not have to be set in the code (see below).
I am not sure how to do this with flags, I am not very familiar with
flags.
Can anyone help me with this?
Sub UpdateData()
Dim dc As Date ' hold the date from the worksheet
Dim sCellAddress As String ' hold the address of the cell
dc = Worksheets("Daily").Range("A1")
If dc = DateSerial(2007, 4, 4) Then
sCellAddress = "B35"
ElseIf dc = DateSerial(2007, 4, 5) Then
sCellAddress = "C35"
ElseIf dc = DateSerial(2007, 4, 6) Then
sCellAddress = "D35"
End If
Worksheets("Daily").Range(sCellAddress) =
Worksheets("Summary").Range("A2").PivotTable.GetPivotData("mnemonic",
"status", "OK")
workbook
and display it in cells on a different worksheet. (keeping the data
static)
This data needs to stay in a specific cell for that day and then it
will be updated with the new numbers in the cell next to it on the
following day.
Currently I am coding this way with If stmts, but would like to use
flags to do this
so static dates do not have to be set in the code (see below).
I am not sure how to do this with flags, I am not very familiar with
flags.
Can anyone help me with this?
Sub UpdateData()
Dim dc As Date ' hold the date from the worksheet
Dim sCellAddress As String ' hold the address of the cell
dc = Worksheets("Daily").Range("A1")
If dc = DateSerial(2007, 4, 4) Then
sCellAddress = "B35"
ElseIf dc = DateSerial(2007, 4, 5) Then
sCellAddress = "C35"
ElseIf dc = DateSerial(2007, 4, 6) Then
sCellAddress = "D35"
End If
Worksheets("Daily").Range(sCellAddress) =
Worksheets("Summary").Range("A2").PivotTable.GetPivotData("mnemonic",
"status", "OK")