code color cells

tuktuk

Well-known Member
Joined
Nov 13, 2006
Messages
856
Hey there,

I have a code that updates data from one file to another.....esentially, i run this code daily and it updates to a compiled daily log of all of the previous days data.

Currently, i am manually coloring the cells to visually assist in grouping what data has been uploaded for each day.

Can anyone help with adding this step to the code below......

Code:
Sub UpdatePOQntyReducDB()
Dim lookupfilename As String

lookupfilename = "\\Sr\SharedDocs\CSPSharedFILES\POQuantityTrackingTool\POQuantityTrackingReport.xls"

Workbooks.Open lookupfilename
Workbooks("POQuantityTrackingReport.xls").Activate

'locate the cell in first column +1 cell past the previous days upload
'this preps for the next upload
Dim LastRowDB As Long
LastRowDB = Cells(Rows.Count, "D").End(xlUp).Row
Range("A" & LastRowDB).Select

'move the actice cell down ONE ROW
ActiveCell.Offset(1, 0).Select


'Open the Current Days Invoices
Workbooks("POQntyReductionTool3.xls").Activate

Dim LastRowPO As Long

'Copy CurrentDays Invoices
LastRowPO = Cells(Rows.Count, "D").End(xlUp).Row
Range("A2:M" & LastRowPO).Select
Selection.Copy

'Open the CompilingMaster tab (database) file
Workbooks("POQuantityTrackingReport.xls").Activate
ActiveSheet.Paste
MsgBox ("Today's invoices have been updated to the POQuantiyTrackingReport.")

Range("A1").Select
ActiveWorkbook.Save
ActiveWorkbook.Close

Workbooks("POQntyReductionTool3.xls").Activate
Range("A1").Select
Workbooks.Close

End Sub

HERE ARE THE TWO COLORS THAT I'D LIKE TO OSSOCILATE BETWEEN:

With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent3
.TintAndShade = 0.799981688894314
.PatternTintAndShade = 0
End With

and

With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent5
.TintAndShade = 0.799981688894314
.PatternTintAndShade = 0
End With

THANKS
Tuktuk
 
gotcha, it is grabbing 19 and 20

but i did find out that i am not starting on the correct row...that is ROW section of my range neeed to be a dynamic range as well

since i've already defined the last row (LastRowDB) in the pastedto worksheet all i need to do is have the range be defined as:

Range("A & LastRow + 1:M" & LastRowPO) BUT THIS GIVES AN ERROR.....

i've also tried:

Range("A & LastRowDB.Offset(1,0):M" & LastRowPO)

ERROR AS WELL!

any suggestions?
 
Upvote 0

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Range("A & LastRow + 1:M" & LastRowPO) BUT THIS GIVES AN ERROR.....

watch your quotes. Should be:

Code:
Range("A" & LastRow + 1 & ":M" & LastRowPO)
 
Upvote 0

Forum statistics

Threads
1,215,330
Messages
6,124,305
Members
449,150
Latest member
NyDarR

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