Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Run Macro after initial cell edit?


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 692
Default Run Macro after initial cell edit?

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Run Macro after initial cell edit?


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 692
Default Run Macro after initial cell edit?

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Run Macro after initial cell edit?


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 692
Default Run Macro after initial cell edit?

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to edit formula in cell Steve Vincent Excel Discussion (Misc queries) 3 January 9th 08 12:09 AM
edit cell by macro helpwithXL Excel Programming 9 April 4th 05 06:21 PM
MACRO TO EDIT CELL FORMULA !! jay dean Excel Programming 3 July 10th 04 04:05 PM
A Macro to Edit Cell Content jer101 Excel Programming 2 June 17th 04 10:42 PM
Macro to edit cell steve Excel Programming 0 August 21st 03 05:48 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"