Macro for filling in information in other cells when an option is selected.

ebeyert

Active Member
Joined
Sep 15, 2006
Messages
287
Excel 2106.

Setup of Worksheet:
Column F (starts from F10), you can choose the option “Closed” and “Cancelled”

Wat I want:
When the option “closed” or “Cancelled” is selected (example:F10). I want the following information to be filled in:

In Column M (M10) the date of today.
In Column AK (AK 10) and AL (AL 10) the text: Closed
In Column AQ (AQ10) and AR (AR10) the number: 100


I have the following macro, where the date is entered in column “M”, but I do not know how to add the other information automatically.
Can someone help me please?

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim lr As Long
Dim trow As Long
lr = Cells(Rows.Count, "F").End(xlUp).Row
trow = Target.Row
If Not Intersect(Target, Range("F10:F" & lr)) Is Nothing And (UCase(Range("F" & trow)) = "CLOSED" Or UCase(Range("F" & trow)) = "CANCELLED") Then
Range("M" & trow) = Date
End If
 
End Sub
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim lr As Long
Dim trow As Long
lr = Cells(Rows.Count, "F").End(xlUp).Row
trow = Target.Row
If Not Intersect(Target, Range("F10:F" & lr)) Is Nothing And (UCase(Range("F" & trow)) = "CLOSED" Or UCase(Range("F" & trow)) = "CANCELLED") Then
Range("M" & trow) = Date
Range("AK" & trow) = "Closed"
Range("AL" & trow) = "Closed"
Range("AQ" & trow).value = 100
Range("AR" & trow).value = 100
End If
 
End Sub

NB - untested!
 
Last edited:
Upvote 0
Pleasure! Thanks for the response.
 
Upvote 0

Forum statistics

Threads
1,215,330
Messages
6,124,305
Members
449,150
Latest member
NyDarR

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