Home Use Cell Attribute in R1C1 Notation
Reply: 0

Use Cell Attribute in R1C1 Notation

user568
1#
user568 Published in May 20, 2018, 11:56 am

I'm running a macro where I define lastcolumnbc using the column attribute

lastcolumnbc = ws.Cells.SpecialCells(xlCellTypeLastCell).Column

Later, I would like to use that attribute in R1C1 to insert a formula into a range:

Set rgbe = .Range(.Cells(1, 2), .Cells(lastrow - 1, 2))
rgbe.Select
Selection.FormulaR1C1 = "=INDEX(RC[1]:RC[lastcolumnbc],MATCH(TRUE,INDEX((RC[1]:RC[lastcolumnbc]<>0),0),0))"
Selection.Columns.AutoFit

Unfortunately this returns an object-defined error.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.310177 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO