Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hello people. First time post. I have a macro that I would like to ru whenever one of the cells in the whole C column is edited. The catc though is that it only runs when edited for the first time and th initial data is inserted, not each time the text is edited afterwards Is there a way to do this? Also, while I am asking. I tried searching but it was being very slo and never gave me results. Is there a way to call the last data from column, so the data from the last filled row in that column? It can b static... I just need to create a "range" viewer for dates that show that my document is from the dates in row A6 through whatever the las row in the A column is, it will change depending on how many tasks have listed for this week. Get back to me if I am not making sense or if you can help. Thanks -- mrpunki ----------------------------------------------------------------------- mrpunkin's Profile: http://www.excelforum.com/member.php...fo&userid=2480 View this thread: http://www.excelforum.com/showthread.php?threadid=38366 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Copy the below code into the worksheet module.
If you enter a cell that is empty and than edit it - you will get a message. If you enter a cell with something already in it and than edit it - you will not get a message. Replace MsgBox "Hi!" with your code. To run a macro - just type in the macro name. ========================================= Public x As Long Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 3 Then If x 0 Then Exit Sub End If Application.EnableEvents = False MsgBox "Hi!" End If Application.EnableEvents = True End Sub Private Sub Worksheet_SelectionChange(ByVal Target As Range) x = Len(Target) End Sub ============================= -- steveB Remove "AYN" from email to respond "mrpunkin" wrote in message ... Hello people. First time post. I have a macro that I would like to run whenever one of the cells in the whole C column is edited. The catch though is that it only runs when edited for the first time and the initial data is inserted, not each time the text is edited afterwards. Is there a way to do this? Also, while I am asking. I tried searching but it was being very slow and never gave me results. Is there a way to call the last data from a column, so the data from the last filled row in that column? It can be static... I just need to create a "range" viewer for dates that shows that my document is from the dates in row A6 through whatever the last row in the A column is, it will change depending on how many tasks I have listed for this week. Get back to me if I am not making sense or if you can help. Thanks. -- mrpunkin ------------------------------------------------------------------------ mrpunkin's Profile: http://www.excelforum.com/member.php...o&userid=24809 View this thread: http://www.excelforum.com/showthread...hreadid=383663 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Thanks, that worked great. The next thing I need to know is if there is a way to make sure that it dies if you do anything besides hit "enter" when done filling in that field. -- mrpunkin ------------------------------------------------------------------------ mrpunkin's Profile: http://www.excelforum.com/member.php...o&userid=24809 View this thread: http://www.excelforum.com/showthread...hreadid=383663 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Not sure of what you mean by "if you do anything besides hit "enter" "
The macros are set up to check if the cell you enter has anything in it. If the cell is blank than the macro will execute after the cell is changed. If the cell already has anything in it, nothing should happen. Any action that sets the cell contents should activate the macro. This includes things like "Tab", "Arror Key", and maybe code. I am not aware of any errors that might occur, but am not positive. Write back if you need more help. p.s. please retain the previous emails in your replys. It helps follow what has already been written. Thanks... -- steveB Remove "AYN" from email to respond "mrpunkin" wrote in message ... Thanks, that worked great. The next thing I need to know is if there is a way to make sure that it dies if you do anything besides hit "enter" when done filling in that field. -- mrpunkin ------------------------------------------------------------------------ mrpunkin's Profile: http://www.excelforum.com/member.php...o&userid=24809 View this thread: http://www.excelforum.com/showthread...hreadid=383663 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Okay. I understand how it works, but my macro is set up with relative positioning and if I go down, left, or up to set the cell that runs this macro when edited the relative positioning screws up and places the stuff in the wrong cells. I can change the relative positioning in the macro but no matter what it will only work correctly if you exit the cell in the one direction that accounts for the relative positioning. I was wondering if I could only make this work by exiting the cell to the right, or if that just isn't possible. If not that is fine as well. STEVE BELL Wrote: Not sure of what you mean by "if you do anything besides hit "enter" " The macros are set up to check if the cell you enter has anything in it. If the cell is blank than the macro will execute after the cell is changed. If the cell already has anything in it, nothing should happen. Any action that sets the cell contents should activate the macro. This includes things like "Tab", "Arror Key", and maybe code. I am not aware of any errors that might occur, but am not positive. Write back if you need more help. p.s. please retain the previous emails in your replys. It helps follow what has already been written. Thanks... -- steveB Remove "AYN" from email to respond "mrpunkin" wrote in message ... Thanks, that worked great. The next thing I need to know is if there is a way to make sure that it dies if you do anything besides hit "enter" when done filling in that field. -- mrpunkin ------------------------------------------------------------------------ mrpunkin's Profile: http://www.excelforum.com/member.php...o&userid=24809 View this thread: http://www.excelforum.com/showthread...hreadid=383663 -- mrpunkin ------------------------------------------------------------------------ mrpunkin's Profile: http://www.excelforum.com/member.php...o&userid=24809 View this thread: http://www.excelforum.com/showthread...hreadid=383663 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can always limit the action by defining the column
here 3 = column C and action will only take place if a cell in column 3 is altered... Doesn't matter where you go when you leave the cell. Only matters which column the selected cell is in. on the change or selection-change code - Target refers to the cell selected, or the cell changed. If Target.Column =3 then -- steveB Remove "AYN" from email to respond "mrpunkin" wrote in message ... Okay. I understand how it works, but my macro is set up with relative positioning and if I go down, left, or up to set the cell that runs this macro when edited the relative positioning screws up and places the stuff in the wrong cells. I can change the relative positioning in the macro but no matter what it will only work correctly if you exit the cell in the one direction that accounts for the relative positioning. I was wondering if I could only make this work by exiting the cell to the right, or if that just isn't possible. If not that is fine as well. STEVE BELL Wrote: Not sure of what you mean by "if you do anything besides hit "enter" " The macros are set up to check if the cell you enter has anything in it. If the cell is blank than the macro will execute after the cell is changed. If the cell already has anything in it, nothing should happen. Any action that sets the cell contents should activate the macro. This includes things like "Tab", "Arror Key", and maybe code. I am not aware of any errors that might occur, but am not positive. Write back if you need more help. p.s. please retain the previous emails in your replys. It helps follow what has already been written. Thanks... -- steveB Remove "AYN" from email to respond "mrpunkin" wrote in message ... Thanks, that worked great. The next thing I need to know is if there is a way to make sure that it dies if you do anything besides hit "enter" when done filling in that field. -- mrpunkin ------------------------------------------------------------------------ mrpunkin's Profile: http://www.excelforum.com/member.php...o&userid=24809 View this thread: http://www.excelforum.com/showthread...hreadid=383663 -- mrpunkin ------------------------------------------------------------------------ mrpunkin's Profile: http://www.excelforum.com/member.php...o&userid=24809 View this thread: http://www.excelforum.com/showthread...hreadid=383663 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to edit formula in cell | Excel Discussion (Misc queries) | |||
edit cell by macro | Excel Programming | |||
MACRO TO EDIT CELL FORMULA !! | Excel Programming | |||
A Macro to Edit Cell Content | Excel Programming | |||
Macro to edit cell | Excel Programming |