Display in Macro when editing the value of a Worksheet range

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

What I need is code to display in Macro when opened for editing, the value of Range "AL2" which contains Row # 4
as seen below macro code now refers to row 36
following is part of my code

' Before runing Macro must Edit the Row # the Scores are being entered in

'Highlight following code at this point, select EDIT, then Replace; in Replac
'Box in Find What area, enter Row # to find and replace; in Replace With area
'enter Row # where you want scores copied to

' Macro set up to enter Scores in Row
'3

'Displays Row # in workshee
'ValueRow = 3
Range("AJ22").Selec
ActiveCell.Value = 3


'Team
Range("c36").Selec
'Application.Goto Reference:="R36C3" 'c3
ActiveCell.Formula = Value01
Range("i36").Selec
'Application.Goto Reference:="R36C9" 'i3
ActiveCell.Formula = Value01

Range("p36").Selec
'Application.Goto Reference:="R36C16" 'p3
ActiveCell.Formula = Value02
Range("v36").Selec
'Application.Goto Reference:="R36C22" 'v3
ActiveCell.Formula = Value02
'Team

Thanks for your hel
Bob Leonar
 
Your code appears to be from a recording session. You need to rework the
code so it is generic and not hardcoded with absolute cell references.

You could put this macro into a Change or SelectionChange event which will
give you a dynamic reference to the cell in the Target variable. If you only
need this to work on certain cells you can test on Target.Address before
doing anything. If it's a valid range, then you can use Target.Address in
your formula.

Alternatively you can use ActiveCell instead of a hard reference. Search
HELP for events or for SelectionChange Event and/or Change Event.

TH
 

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