Hi
I have been tinkering around trying to figure this out and to be quite honest got nowhere really.
I have code (recycled) in Access that loops through a query and generates a budget file for each person.
I would like to colour a range of cells based on the number of rows in the sheet, some people may have more clients than other. The cells have no data and the colouring is to lead people to which cells they need to enter data into.
The code I have so far is below, its a work in progress as I tidy up along the way, however this is the first part I have no idea on.
Set ApXL = CreateObject("Excel.Application")
With ApXL
.Application.Visible = False
.UserControl = False
.Workbooks.Open strPath & strBrokerCode & " - FullIncomeRpt.xls"
' Formatting
.Columns("A:A").ColumnWidth = 7.5
.Columns("B:B").ColumnWidth = 33
.Columns("C:G").Select
.Selection.ColumnWidth = 12
.Columns("C").NumberFormat = "#,##0.00_);[Red](#,##0.00)"
.Columns("D").NumberFormat = "#,##0.00_);[Red](#,##0.00)"
.Columns("E").NumberFormat = "#,##0.00_);[Red](#,##0.00)"
.Columns("F").NumberFormat = "#,##0.00_);[Red](#,##0.00)"
.Columns("G").NumberFormat = "#,##0.00_);[Red](#,##0.00)"
.Range("I1").Formula = "Forecast Remainder 2010"
.Range("J1").Formula = "Full Year Forecast 2010"
.Range("L1").Formula = "Phasing Required"
.Range("N1").Formula = "Budget 2011"
.Range("P1").Formula = "Jan"
.Range("Q1").Formula = "Feb"
.Range("R1").Formula = "Mar"
.Range("S1").Formula = "Apr"
.Range("T1").Formula = "May"
.Range("U1").Formula = "Jun"
.Range("V1").Formula = "Jul"
.Range("W1").Formula = "Aug"
.Range("X1").Formula = "Sep"
.Range("Y1").Formula = "Oct"
.Range("Z1").Formula = "Nov"
.Range("AA1").Formula = "Dec"
.Range("AB1").Formula = "Err/Chk"
.Rows("1:1").Select
.Selection.WrapText = True
.Selection.RowHeight = 50
.Rows("2:4").Select
.Selection.Insert shift:=xlDown
.Selection.Interior.ColorIndex = xlNone
.Selection.RowHeight = 15
.Range("A1").Select
' Formula
Anything you can offer is appreciated.
Rob
Bookmarks