ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Display in Macro when editing the value of a Worksheet range (https://www.excelbanter.com/excel-programming/296974-display-macro-when-editing-value-worksheet-range.html)

rleonard

Display in Macro when editing the value of a Worksheet range
 

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

NEED TO DISPLAY VALUE OF WORKSHEET RANGE "AL2" HERE SO KNOW WHAT TO CHANGE 36 TO


FOR EXAMPLE CURRENT ROW TO POST IS: 4


' 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






TH[_3_]

Display in Macro when editing the value of a Worksheet range
 
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

On 5/1/04 15:11, in article
, "rleonard"
wrote:

What I need is code to display in Macro when opened for editing, the value of
Range "AL2" which contains Row # 40
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 Replace
'Box in Find What area, enter Row # to find and replace; in Replace With area,
'enter Row # where you want scores copied to!

NEED TO DISPLAY VALUE OF WORKSHEET RANGE "AL2" HERE SO KNOW WHAT TO CHANGE
36 TO.


FOR EXAMPLE CURRENT ROW TO POST IS: 40


' Macro set up to enter Scores in Row:
'36

'Displays Row # in worksheet
'ValueRow = 36
Range("AJ22").Select
ActiveCell.Value = 36


'Team 1
Range("c36").Select
'Application.Goto Reference:="R36C3" 'c36
ActiveCell.Formula = Value01a
Range("i36").Select
'Application.Goto Reference:="R36C9" 'i36
ActiveCell.Formula = Value01b

Range("p36").Select
'Application.Goto Reference:="R36C16" 'p36
ActiveCell.Formula = Value02a
Range("v36").Select
'Application.Goto Reference:="R36C22" 'v36
ActiveCell.Formula = Value02b
'Team 3

Thanks for your help
Bob Leonard








All times are GMT +1. The time now is 02:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com