ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   indicate a change in a row (https://www.excelbanter.com/excel-discussion-misc-queries/155487-indicate-change-row.html)

Picman

indicate a change in a row
 
I would like to indicate with a specific value ("C") in the first cell of a
row if any changes have been made in that row since the file was created. In
other words if a value was input or changed in cell "M1" i would like cell
"A1" to be populated with a "C". Can this be done?

Gary''s Student

indicate a change in a row
 
Put the following macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Cells(Target.Row, 1).Value = "C"
Application.EnableEvents = True
End Sub

--
Gary''s Student - gsnu200738


"Picman" wrote:

I would like to indicate with a specific value ("C") in the first cell of a
row if any changes have been made in that row since the file was created. In
other words if a value was input or changed in cell "M1" i would like cell
"A1" to be populated with a "C". Can this be done?


Picman

indicate a change in a row
 
Could you walk me through the "worksheet code area". I'm not familier with
this part of Excel. Also how can i change the coordinates of the destination
cell to allow for column headings etc?

"Gary''s Student" wrote:

Put the following macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Cells(Target.Row, 1).Value = "C"
Application.EnableEvents = True
End Sub

--
Gary''s Student - gsnu200738


"Picman" wrote:

I would like to indicate with a specific value ("C") in the first cell of a
row if any changes have been made in that row since the file was created. In
other words if a value was input or changed in cell "M1" i would like cell
"A1" to be populated with a "C". Can this be done?


Dave Peterson

indicate a change in a row
 
Right click on the worksheet tab that should have this behavior and select view
code. Then paste this into the newly opened codewindow.



Picman wrote:

Could you walk me through the "worksheet code area". I'm not familier with
this part of Excel. Also how can i change the coordinates of the destination
cell to allow for column headings etc?

"Gary''s Student" wrote:

Put the following macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Cells(Target.Row, 1).Value = "C"
Application.EnableEvents = True
End Sub

--
Gary''s Student - gsnu200738


"Picman" wrote:

I would like to indicate with a specific value ("C") in the first cell of a
row if any changes have been made in that row since the file was created. In
other words if a value was input or changed in cell "M1" i would like cell
"A1" to be populated with a "C". Can this be done?


--

Dave Peterson

Picman

indicate a change in a row
 
I must be missing something here because this did nothing.

"Dave Peterson" wrote:

Right click on the worksheet tab that should have this behavior and select view
code. Then paste this into the newly opened codewindow.



Picman wrote:

Could you walk me through the "worksheet code area". I'm not familier with
this part of Excel. Also how can i change the coordinates of the destination
cell to allow for column headings etc?

"Gary''s Student" wrote:

Put the following macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Cells(Target.Row, 1).Value = "C"
Application.EnableEvents = True
End Sub

--
Gary''s Student - gsnu200738


"Picman" wrote:

I would like to indicate with a specific value ("C") in the first cell of a
row if any changes have been made in that row since the file was created. In
other words if a value was input or changed in cell "M1" i would like cell
"A1" to be populated with a "C". Can this be done?


--

Dave Peterson


Dave Peterson

indicate a change in a row
 
Macros have to be enabled.
Events can't be disabled.

Put the code in the worksheet module.
Save and close the workbook.
reopen the workbook

If you get prompted to allow macros, answer yes.

Then change a cell outside of column A to see if it works.

====
If you don't get prompted, then post back with the version of excel you're
using.

Picman wrote:

I must be missing something here because this did nothing.

"Dave Peterson" wrote:

Right click on the worksheet tab that should have this behavior and select view
code. Then paste this into the newly opened codewindow.



Picman wrote:

Could you walk me through the "worksheet code area". I'm not familier with
this part of Excel. Also how can i change the coordinates of the destination
cell to allow for column headings etc?

"Gary''s Student" wrote:

Put the following macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Cells(Target.Row, 1).Value = "C"
Application.EnableEvents = True
End Sub

--
Gary''s Student - gsnu200738


"Picman" wrote:

I would like to indicate with a specific value ("C") in the first cell of a
row if any changes have been made in that row since the file was created. In
other words if a value was input or changed in cell "M1" i would like cell
"A1" to be populated with a "C". Can this be done?


--

Dave Peterson


--

Dave Peterson

Picman

indicate a change in a row
 
I'm still getting nothing. I'm using Excel 2003. The data in this worksheet
begins on row 7 (headers above that), and column C is where I would like the
indicator to go. It should indicate a "C" in column c if any data is changed
in any cell in columns to the right of that (D,E,F...etc.)

"Dave Peterson" wrote:

Macros have to be enabled.
Events can't be disabled.

Put the code in the worksheet module.
Save and close the workbook.
reopen the workbook

If you get prompted to allow macros, answer yes.

Then change a cell outside of column A to see if it works.

====
If you don't get prompted, then post back with the version of excel you're
using.

Picman wrote:

I must be missing something here because this did nothing.

"Dave Peterson" wrote:

Right click on the worksheet tab that should have this behavior and select view
code. Then paste this into the newly opened codewindow.



Picman wrote:

Could you walk me through the "worksheet code area". I'm not familier with
this part of Excel. Also how can i change the coordinates of the destination
cell to allow for column headings etc?

"Gary''s Student" wrote:

Put the following macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Cells(Target.Row, 1).Value = "C"
Application.EnableEvents = True
End Sub

--
Gary''s Student - gsnu200738


"Picman" wrote:

I would like to indicate with a specific value ("C") in the first cell of a
row if any changes have been made in that row since the file was created. In
other words if a value was input or changed in cell "M1" i would like cell
"A1" to be populated with a "C". Can this be done?

--

Dave Peterson


--

Dave Peterson


Dave Peterson

indicate a change in a row
 
Try this:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

Dim myRng As Range
Dim myRow As Range
Dim myRngToInspect As Range

With Me
Set myRngToInspect = .Range("D7", .Cells(.Rows.Count, .Columns.Count))
End With

Set myRng = Intersect(Target, myRngToInspect)

If myRng Is Nothing Then
Exit Sub
End If

Application.EnableEvents = False
For Each myRow In myRng.Rows
Me.Cells(myRow.Row, "C").Value = "C"
Next myRow
Application.EnableEvents = True

End Sub


If it doesn't work, post back with the version of the code you used. Include
where you placed the code.

Picman wrote:

I'm still getting nothing. I'm using Excel 2003. The data in this worksheet
begins on row 7 (headers above that), and column C is where I would like the
indicator to go. It should indicate a "C" in column c if any data is changed
in any cell in columns to the right of that (D,E,F...etc.)

"Dave Peterson" wrote:

Macros have to be enabled.
Events can't be disabled.

Put the code in the worksheet module.
Save and close the workbook.
reopen the workbook

If you get prompted to allow macros, answer yes.

Then change a cell outside of column A to see if it works.

====
If you don't get prompted, then post back with the version of excel you're
using.

Picman wrote:

I must be missing something here because this did nothing.

"Dave Peterson" wrote:

Right click on the worksheet tab that should have this behavior and select view
code. Then paste this into the newly opened codewindow.



Picman wrote:

Could you walk me through the "worksheet code area". I'm not familier with
this part of Excel. Also how can i change the coordinates of the destination
cell to allow for column headings etc?

"Gary''s Student" wrote:

Put the following macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Cells(Target.Row, 1).Value = "C"
Application.EnableEvents = True
End Sub

--
Gary''s Student - gsnu200738


"Picman" wrote:

I would like to indicate with a specific value ("C") in the first cell of a
row if any changes have been made in that row since the file was created. In
other words if a value was input or changed in cell "M1" i would like cell
"A1" to be populated with a "C". Can this be done?

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson

Picman

indicate a change in a row
 
That worked perfectly. Thank you very much.

"Dave Peterson" wrote:

Try this:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

Dim myRng As Range
Dim myRow As Range
Dim myRngToInspect As Range

With Me
Set myRngToInspect = .Range("D7", .Cells(.Rows.Count, .Columns.Count))
End With

Set myRng = Intersect(Target, myRngToInspect)

If myRng Is Nothing Then
Exit Sub
End If

Application.EnableEvents = False
For Each myRow In myRng.Rows
Me.Cells(myRow.Row, "C").Value = "C"
Next myRow
Application.EnableEvents = True

End Sub


If it doesn't work, post back with the version of the code you used. Include
where you placed the code.

Picman wrote:

I'm still getting nothing. I'm using Excel 2003. The data in this worksheet
begins on row 7 (headers above that), and column C is where I would like the
indicator to go. It should indicate a "C" in column c if any data is changed
in any cell in columns to the right of that (D,E,F...etc.)

"Dave Peterson" wrote:

Macros have to be enabled.
Events can't be disabled.

Put the code in the worksheet module.
Save and close the workbook.
reopen the workbook

If you get prompted to allow macros, answer yes.

Then change a cell outside of column A to see if it works.

====
If you don't get prompted, then post back with the version of excel you're
using.

Picman wrote:

I must be missing something here because this did nothing.

"Dave Peterson" wrote:

Right click on the worksheet tab that should have this behavior and select view
code. Then paste this into the newly opened codewindow.



Picman wrote:

Could you walk me through the "worksheet code area". I'm not familier with
this part of Excel. Also how can i change the coordinates of the destination
cell to allow for column headings etc?

"Gary''s Student" wrote:

Put the following macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Cells(Target.Row, 1).Value = "C"
Application.EnableEvents = True
End Sub

--
Gary''s Student - gsnu200738


"Picman" wrote:

I would like to indicate with a specific value ("C") in the first cell of a
row if any changes have been made in that row since the file was created. In
other words if a value was input or changed in cell "M1" i would like cell
"A1" to be populated with a "C". Can this be done?

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


mmccoog

indicate a change in a row
 
This is great and very usefule. I noticed that the undo function is disabled.
Is that more complicated to change?

"Dave Peterson" wrote:

Try this:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

Dim myRng As Range
Dim myRow As Range
Dim myRngToInspect As Range

With Me
Set myRngToInspect = .Range("D7", .Cells(.Rows.Count, .Columns.Count))
End With

Set myRng = Intersect(Target, myRngToInspect)

If myRng Is Nothing Then
Exit Sub
End If

Application.EnableEvents = False
For Each myRow In myRng.Rows
Me.Cells(myRow.Row, "C").Value = "C"
Next myRow
Application.EnableEvents = True

End Sub


If it doesn't work, post back with the version of the code you used. Include
where you placed the code.

Picman wrote:

I'm still getting nothing. I'm using Excel 2003. The data in this worksheet
begins on row 7 (headers above that), and column C is where I would like the
indicator to go. It should indicate a "C" in column c if any data is changed
in any cell in columns to the right of that (D,E,F...etc.)

"Dave Peterson" wrote:

Macros have to be enabled.
Events can't be disabled.

Put the code in the worksheet module.
Save and close the workbook.
reopen the workbook

If you get prompted to allow macros, answer yes.

Then change a cell outside of column A to see if it works.

====
If you don't get prompted, then post back with the version of excel you're
using.

Picman wrote:

I must be missing something here because this did nothing.

"Dave Peterson" wrote:

Right click on the worksheet tab that should have this behavior and select view
code. Then paste this into the newly opened codewindow.



Picman wrote:

Could you walk me through the "worksheet code area". I'm not familier with
this part of Excel. Also how can i change the coordinates of the destination
cell to allow for column headings etc?

"Gary''s Student" wrote:

Put the following macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Cells(Target.Row, 1).Value = "C"
Application.EnableEvents = True
End Sub

--
Gary''s Student - gsnu200738


"Picman" wrote:

I would like to indicate with a specific value ("C") in the first cell of a
row if any changes have been made in that row since the file was created. In
other words if a value was input or changed in cell "M1" i would like cell
"A1" to be populated with a "C". Can this be done?

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


Peo Sjoblom

indicate a change in a row
 
You can't undo macros. If you don't like what you get you need to exit from
excel without saving


--


Regards,


Peo Sjoblom



"mmccoog" wrote in message
...
This is great and very usefule. I noticed that the undo function is
disabled.
Is that more complicated to change?

"Dave Peterson" wrote:

Try this:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

Dim myRng As Range
Dim myRow As Range
Dim myRngToInspect As Range

With Me
Set myRngToInspect = .Range("D7", .Cells(.Rows.Count,
.Columns.Count))
End With

Set myRng = Intersect(Target, myRngToInspect)

If myRng Is Nothing Then
Exit Sub
End If

Application.EnableEvents = False
For Each myRow In myRng.Rows
Me.Cells(myRow.Row, "C").Value = "C"
Next myRow
Application.EnableEvents = True

End Sub


If it doesn't work, post back with the version of the code you used.
Include
where you placed the code.

Picman wrote:

I'm still getting nothing. I'm using Excel 2003. The data in this
worksheet
begins on row 7 (headers above that), and column C is where I would
like the
indicator to go. It should indicate a "C" in column c if any data is
changed
in any cell in columns to the right of that (D,E,F...etc.)

"Dave Peterson" wrote:

Macros have to be enabled.
Events can't be disabled.

Put the code in the worksheet module.
Save and close the workbook.
reopen the workbook

If you get prompted to allow macros, answer yes.

Then change a cell outside of column A to see if it works.

====
If you don't get prompted, then post back with the version of excel
you're
using.

Picman wrote:

I must be missing something here because this did nothing.

"Dave Peterson" wrote:

Right click on the worksheet tab that should have this behavior
and select view
code. Then paste this into the newly opened codewindow.



Picman wrote:

Could you walk me through the "worksheet code area". I'm not
familier with
this part of Excel. Also how can i change the coordinates of
the destination
cell to allow for column headings etc?

"Gary''s Student" wrote:

Put the following macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Cells(Target.Row, 1).Value = "C"
Application.EnableEvents = True
End Sub

--
Gary''s Student - gsnu200738


"Picman" wrote:

I would like to indicate with a specific value ("C") in the
first cell of a
row if any changes have been made in that row since the
file was created. In
other words if a value was input or changed in cell "M1" i
would like cell
"A1" to be populated with a "C". Can this be done?

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson




Gord Dibben

indicate a change in a row
 
John Walkenbach's site has "undo" code for reversing the effects of macro
changes but I think might be difficult to use on event code.

http://www.j-walk.com/ss/excel/tips/tip23.htm

Undoing a VBA Subroutine

Computer users have become accustomed to the ability to "undo" an operation.
Almost every operation you perform in Excel can be undone. If you program in
VBA, you may have wondered if it's possible to undo the effects of a subroutine.
The answer is yes. The qualified answer is it's not always easy.

Making the effects of your subroutines undoable isn't automatic. Your subroutine
will need to store the previous state so it can be restored if the user choose
the Edit Undo command. How you do this will vary, depending on what the
subroutine does. In extreme cases, you might need to save an entire worksheet.
If your subroutine modifies a range, for example, you need only save the
contents of that range.


Gord Dibben MS Excel MVP


On Wed, 3 Oct 2007 10:47:47 -0700, "Peo Sjoblom" wrote:

You can't undo macros. If you don't like what you get you need to exit from
excel without saving



mmccoog

indicate a change in a row
 
I knew it was too good to be true.
Thanks!

"Gord Dibben" wrote:

John Walkenbach's site has "undo" code for reversing the effects of macro
changes but I think might be difficult to use on event code.

http://www.j-walk.com/ss/excel/tips/tip23.htm

Undoing a VBA Subroutine

Computer users have become accustomed to the ability to "undo" an operation.
Almost every operation you perform in Excel can be undone. If you program in
VBA, you may have wondered if it's possible to undo the effects of a subroutine.
The answer is yes. The qualified answer is it's not always easy.

Making the effects of your subroutines undoable isn't automatic. Your subroutine
will need to store the previous state so it can be restored if the user choose
the Edit Undo command. How you do this will vary, depending on what the
subroutine does. In extreme cases, you might need to save an entire worksheet.
If your subroutine modifies a range, for example, you need only save the
contents of that range.


Gord Dibben MS Excel MVP


On Wed, 3 Oct 2007 10:47:47 -0700, "Peo Sjoblom" wrote:

You can't undo macros. If you don't like what you get you need to exit from
excel without saving





All times are GMT +1. The time now is 02:24 AM.

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