Home |
Search |
Today's Posts |
#11
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
They are both Longs, so you can't use like that, as it is expecting
string/long. Try this For i = 1 To sn.Count With xlapp.Workbooks(strXlsFile).Worksheets(sn(i)) .Cells(1).EntireRow.HorizontalAlignment = xlCenter .Cells(1).EntireRow.Font.Bold = True .Range(.Range("C2") & .Cells(LastRow, LastColumn)).NumberFormat = "0.0000" .Range("D2:D" & LastRow).Formula = "=STDEV(E2:AH2)" .Columns.AutoFit End With Next i -- HTH RP (remove nothere from the email address if mailing direct) "deko" wrote in message m... It is not looping so it would be fast. Probably not as fast as SpecialCells, but as Ron points out, SpecialCells will give a wrong answer in certain circumstances. I will definitely use those functions - from what I've read they are preferred over SpecialCells for the reasons Ron described. Still, it's using the cell number to define the last column that's got me confused. For example, how do I set the NumberFormat below? Here is my loop: For i = 1 To sn.Count With xlapp.Workbooks(strXlsFile).Worksheets(sn(i)) .Cells(1).EntireRow.HorizontalAlignment = xlCenter .Cells(1).EntireRow.Font.Bold = True .Range("C2:" & LastColumn & LastRow).Cells.NumberFormat = "0.0000" .Range("D2:D" & LastRow).Formula = "=STDEV(E2:AH2)" .Columns.AutoFit End With Next i Clearly, "LastColumn & LastRow" fails. But how else do I define this range? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
FInd common data in one column then add number in adjacent column | Excel Worksheet Functions | |||
find last row value in column when using MATCH to find column | Excel Worksheet Functions | |||
Find something in column a then find if column B matches criteria | Excel Discussion (Misc queries) | |||
Find First Non blank cell than find column header and return that value | Excel Worksheet Functions | |||
Need Macro to Find Column Heading -- if none, then insert new column | Excel Programming |