Share via

Automatic trigger to populate cells

Anonymous
2012-01-19T17:37:07+00:00

Can a value typed in one cell trigger a different value to populate another cell?  E.g., if I type X in cell A1, I want Q to appear in cell A3; and I want this to occur every time I type X in any cell ---  Q should appear two cells to the right, on the same row.

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2012-01-19T18:06:18+00:00

... if I type X in cell A1, I want Q to appear in cell A3 ... every time I type X in any cell ---  Q should appear two cells to the right, on the same row.

Is it two cells to the right or two cells down? The description seems to contradict itself. I'll assume that the former is correct.

Right-click the worksheet's name tab and select View Code. When teh VBE opens, paste the following into the pane titled something like Book1 - Sheet1 (Code).

Private Sub Worksheet_Change(ByVal Target As Range)

    Application.EnableEvents = False

    If Target = "X" Then Target.Offset(0, 2) = "Q"

    Application.EnableEvents = True

End Sub

Press Alt+Q when done to return to your worksheet. The workbook will have to be saved as a macro-enabled workbook.

I'm pretty sure that there is more to what you want than just this, but you'll have to provide a little more detail.

Was this answer helpful?

0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2012-01-19T18:28:01+00:00

    That's exactly what I need; thank you.  And, yes, the original question should have referenced cells A1 and C1.

    Was this answer helpful?

    0 comments No comments