locked
How to add a column to .Address RRS feed

  • Question

  • How can I add a column to the result of the following VBA formula.

    Formula results = A10

    Desired results = B10

    LKCell.Offset(0, recFound) = Split(TFCell.Address, "$")(1) & Split(TFCell.Address, "$")(2)


    heads up

    Saturday, August 15, 2015 4:59 AM

Answers

  •  [A10].Select 

     ActiveCell.Offset(,1).Select

    Please never use SELECT, SELECTION, ACTIVECELL, it is slow and error prone. Always refer to the objects directly.

    This

      LKCell.Offset(0, recFound) = TFCell.Address(0,0)

    is the same as

      LKCell.Offset(0, recFound) = Split(TFCell.Address, "$")(1) & Split(TFCell.Address, "$")(2)

    so the next column to TFCell is

      LKCell.Offset(0, recFound) = TFCell.Offset(,1).Address(0,0)

    Andreas.

    Saturday, August 15, 2015 11:05 AM
  •  [A10].Select 

     ActiveCell.Offset(,1).Select

    'Cells(ActiveCell.Row, ActiveCell.Column+1).Select

    'ActiveCell(1, 2).Select

    Saturday, August 15, 2015 5:40 AM

All replies

  •  [A10].Select 

     ActiveCell.Offset(,1).Select

    'Cells(ActiveCell.Row, ActiveCell.Column+1).Select

    'ActiveCell(1, 2).Select

    Saturday, August 15, 2015 5:40 AM
  •  [A10].Select 

     ActiveCell.Offset(,1).Select

    Please never use SELECT, SELECTION, ACTIVECELL, it is slow and error prone. Always refer to the objects directly.

    This

      LKCell.Offset(0, recFound) = TFCell.Address(0,0)

    is the same as

      LKCell.Offset(0, recFound) = Split(TFCell.Address, "$")(1) & Split(TFCell.Address, "$")(2)

    so the next column to TFCell is

      LKCell.Offset(0, recFound) = TFCell.Offset(,1).Address(0,0)

    Andreas.

    Saturday, August 15, 2015 11:05 AM