I need to count the number of columns within a variable range and use the address of the last column to form part of defined range. Once I have defined the range I will want to input a formula. Can anyone please help?
Example
Dim lastcolumn as string
Lastcolumn = sheet("test").range("a1").end(xltoright).column
Sheets("test").range("b1:" & lastcolumn).select
Selection.formula = "myformula"
sheet("test").range("a1").end(xltoright).formula="xyz"should do it I think, last column would be an integer. or maybecells(sheet("test").range("a1").end(xltoRight),1).formula