FormulaR1C1

  • Thread starter Thread starter Marc
  • Start date Start date
M

Marc

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?
 
dim target as Range
SET target = Range("{your range here}")
with target
.FormulaR1C1 = "{your formula here}"
end with
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top