Quick Question Re Macro

Jay3

Board Regular
Joined
Jul 3, 2009
Messages
237
Hi All,

I have the following macro which saves my spreadsheet each time a user click on a cell in column A where there is no data;

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  If Not Intersect(Target, Columns("A")) Is Nothing Then
    If IsEmpty(Target) Then
      ThisWorkbook.Save
    End If
  End If
End Sub

I need to tweak the code so that the workbook is again saved after the user has entered data in col A and then navigated away.

Any suggestions?

Thanks,
Jay3:biggrin:
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Hi. Try adding this

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 Then ThisWorkbook.Save
End Sub
 
Upvote 0
Hi,

Just tried it and the following error message was displayed?


Ambigious name detected - Worksheet change

Any ideas?

Thanks,
John
 
Upvote 0
Here you go.

Code:
Option Explicit
Option Compare Text
Private Sub Worksheet_Change(ByVal Target As Range)
  
  If Not Intersect(Target, Columns("H")) Is Nothing Then
    If Target.Value = "YES" Then
      Call Mail_Small_Text_Outlook(Target.Row)
        Call Create_Reminder(Target.Row)
        ThisWorkbook.Save
    End If
  End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  If Not Intersect(Target, Columns("A")) Is Nothing Then
    If IsEmpty(Target) Then
      ThisWorkbook.Save
    End If
  End If
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 Then ThisWorkbook.Save
End Sub

Thanks
Jay3
 
Upvote 0
Try this

Code:
Option Explicit
Option Compare Text
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 Then ThisWorkbook.Save
  
  If Not Intersect(Target, Columns("H")) Is Nothing Then
    If Target.Value = "YES" Then
      Call Mail_Small_Text_Outlook(Target.Row)
        Call Create_Reminder(Target.Row)
        ThisWorkbook.Save
    End If
  End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  If Not Intersect(Target, Columns("A")) Is Nothing Then
    If IsEmpty(Target) Then
      ThisWorkbook.Save
    End If
  End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,291
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top