Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
change event
Hi Group,
I am new to programming so please bear with me I am trying to force the contents of cell A1 to the center header field everytime the cell is changed. I have written the code to place the contents into the header but need help with the change event. I am getting a syntax error. TIA for the help and any advise to improve my skills Header code Sub HeaderFromCell() ActiveSheet.PageSetup.CenterHeader = _ Format(Worksheets("Action List").Range("A2").Value) End Sub Change code Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells = (2, 1)Then HeaderFromCell () End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
change event
If you have provided actual code and not pseudo code, then the problem is in
your if statement testing for the cell location. Try if Target.cells.row = 2 and Target.cells.col = 1 then HeaderFromCell() "Ray A" wrote: Hi Group, I am new to programming so please bear with me I am trying to force the contents of cell A1 to the center header field everytime the cell is changed. I have written the code to place the contents into the header but need help with the change event. I am getting a syntax error. TIA for the help and any advise to improve my skills Header code Sub HeaderFromCell() ActiveSheet.PageSetup.CenterHeader = _ Format(Worksheets("Action List").Range("A2").Value) End Sub Change code Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells = (2, 1)Then HeaderFromCell () End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
change event
I think you want
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address= "$A$1" Then HeaderFromCell () End Sub -- HTH Bob Phillips (remove nothere from email address if mailing direct) "Ray A" wrote in message ... Hi Group, I am new to programming so please bear with me I am trying to force the contents of cell A1 to the center header field everytime the cell is changed. I have written the code to place the contents into the header but need help with the change event. I am getting a syntax error. TIA for the help and any advise to improve my skills Header code Sub HeaderFromCell() ActiveSheet.PageSetup.CenterHeader = _ Format(Worksheets("Action List").Range("A2").Value) End Sub Change code Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells = (2, 1)Then HeaderFromCell () End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Cell value change to trigger macro (worksheet change event?) | Excel Programming | |||
Change event and calculate event | Excel Programming | |||
Change Cell from Validated List Not Firing Worksheet Change Event | Excel Programming | |||
change event/after update event?? | Excel Programming |