White S to cell by press cell

KlausW

Active Member
Joined
Sep 9, 2020
Messages
458
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

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
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,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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