PDA

View Full Version : Solved: Selecting range of cells



SeanJ
08-07-2008, 04:07 AM
Hi guys I need help again. The code below represents a header that will be duplicated several time over again on a sheet. The problem is that I need to select those cells then center them and then bold them. I can't figure out how to select the range since they will repeat in different row everytime this part of the code is run. :banghead:


wksDest.Cells(x + 1, 1).Value = Left$(wbk.Name, Len(wbk.Name) - 4)
wksDest.Cells(x + 1, 2).Value = "Contract"
wksDest.Cells(x + 1, 3).Value = "Billed to Date"
wksDest.Cells(x + 1, 4).Value = "Balance"
wksDest.Cells(x + 1, 5).Value = "Est. % Disb."

Bob Phillips
08-07-2008, 04:34 AM
With wksDest.Cells(x + 1, 1).Resize(, 5)

.Value = Array("", "Contract", "Billed to Date", "Balance", "Est. % Disb.")
.Cells(1, 1).Value = Left$(wbk.Name, Len(wbk.Name) - 4)
.Font.Bold = True
.HorizontalAlignment = xlCenter
End With

SeanJ
08-07-2008, 06:06 AM
That works great thank you.

I got one more request. I am pulling data from another workbook, and I need to know the last row of any worksheet in that workbook. There will be empty row before that last row. I need to find the total number of rows of a sheet.

Aussiebear
08-07-2008, 06:11 AM
SeanJ, Would you like to start a new thread with this last request? It is after all significantly different to your initial request for assistance


I got one more request. I am pulling data from another workbook, and I need to know the last row of any worksheet in that workbook. There will be empty row before that last row. I need to find the total number of rows of a sheet.

SeanJ
08-07-2008, 06:16 AM
will do