ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   FormulaR1C1 (https://www.excelbanter.com/excel-programming/420826-formular1c1.html)

Marc[_26_]

FormulaR1C1
 
I have vfp code like below
loExcelSession.Cells(1,11).FormulaR1C1 =
ALLTRIM(STR(loExcelSession.Cells(1,11).Value))
Is there anyway to update the entire column at once?



Patrick Molloy[_2_]

FormulaR1C1
 
dim target as Range
SET target = Range("{your range here}")
with target
.FormulaR1C1 = "{your formula here}"
end with



"Marc" wrote:

I have vfp code like below
loExcelSession.Cells(1,11).FormulaR1C1 =
ALLTRIM(STR(loExcelSession.Cells(1,11).Value))
Is there anyway to update the entire column at once?




Bob Phillips[_3_]

FormulaR1C1
 
Try this

With loExcelSession

LastRow = .Cells(.Rows.Count, 11).End(xlUp).Row
.Columns(12).Insert
.Cells(1,12).Resize(LastRow).Formula = "=TRIM(A11)"
.Cells(1,12).Resize(LastRow).Value = .Cells(1,12).Resize(LastRow).Value
.Columns(11).Delete
End With


--
__________________________________
HTH

Bob

"Marc" wrote in message
...
I have vfp code like below
loExcelSession.Cells(1,11).FormulaR1C1 =
ALLTRIM(STR(loExcelSession.Cells(1,11).Value))
Is there anyway to update the entire column at once?






All times are GMT +1. The time now is 12:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com