elliott740
Board Regular
- Joined
- Mar 14, 2008
- Messages
- 52
I am using the following code and it works just fine but is there a better way to do it? Can I do the assignment and the formatting in one step?
[For MthCtr = QtrStart To BwCol Step 4
Worksheets(WorksheetName).Cells(RowCounter, 12).Value = Worksheets(WorksheetName).Cells(RowCounter, 12).Value + Worksheets("Sales_Query1").Cells(LoopCounter, MthCtr).Value 'QTD Sales
Worksheets(WorksheetName).Cells(RowCounter, 13).Value = Worksheets(WorksheetName).Cells(RowCounter, 13).Value + Worksheets("Sales_Query1").Cells(LoopCounter, MthCtr + 1).Value 'QTD Budget
Worksheets(WorksheetName).Cells(RowCounter, 14).Value = Worksheets(WorksheetName).Cells(RowCounter, 14).Value + Worksheets("Sales_Query1").Cells(LoopCounter, MthCtr - 48).Value 'QTD LY Sales
Next MthCtr
With Worksheets(WorksheetName)
.Range("L7:N14").NumberFormat = "$#,##0_);($#,##0)"
End With
[For MthCtr = QtrStart To BwCol Step 4
Worksheets(WorksheetName).Cells(RowCounter, 12).Value = Worksheets(WorksheetName).Cells(RowCounter, 12).Value + Worksheets("Sales_Query1").Cells(LoopCounter, MthCtr).Value 'QTD Sales
Worksheets(WorksheetName).Cells(RowCounter, 13).Value = Worksheets(WorksheetName).Cells(RowCounter, 13).Value + Worksheets("Sales_Query1").Cells(LoopCounter, MthCtr + 1).Value 'QTD Budget
Worksheets(WorksheetName).Cells(RowCounter, 14).Value = Worksheets(WorksheetName).Cells(RowCounter, 14).Value + Worksheets("Sales_Query1").Cells(LoopCounter, MthCtr - 48).Value 'QTD LY Sales
Next MthCtr
With Worksheets(WorksheetName)
.Range("L7:N14").NumberFormat = "$#,##0_);($#,##0)"
End With