White S to cell by press cell

KlausW

Active Member
Joined
Sep 9, 2020
Messages
453
Office Version
  1. 2016
Platform
  1. Windows
Hi every one

I have this VBA code that runs perfect. In column A there are dates, when I press in a cell in column J the date will be showen in cell j1.

Example I press in j2 and the date 01-05-2024 comes from A2 (Danish date) in cell J1, I press cells j3 then 02-05-2024 appears in cell j1 etc. Can you make it so that an S appears in column J in the cells you press.

Any help will be appreciated

Best Regards

Klaus W

VBA Code:
Option Explicit
 
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Selection.Count = 1 Then
    If Not Intersect(Target, Range("$j$2:$j$41")) Is Nothing Then
        
        Range("$J$1").Value = Target.Offset(0, -9).Value
        'MsgBox "Mail"
            'Call
        End If
    End If

End Sub
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
You mean like this:
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

    If Selection.Count = 1 Then
        If Not Intersect(Target, Range("J2:J41")) Is Nothing Then
            Range("J1").Value = Target.Offset(0, -9).Value
            Target.Value = "S"
        End If
    End If
End Sub
 
Upvote 0
Solution
You mean like this:
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

    If Selection.Count = 1 Then
        If Not Intersect(Target, Range("J2:J41")) Is Nothing Then
            Range("J1").Value = Target.Offset(0, -9).Value
            Target.Value = "S"
        End If
    End If
End Sub
Thanks it just as it shout be. Have a nice day. KW
 
Upvote 0

Forum statistics

Threads
1,223,889
Messages
6,175,224
Members
452,620
Latest member
dsubash

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