2 worksheet change events

Zdavis123

New Member
Joined
May 26, 2022
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Hi guys, I have these 2 Worksheet change events which im struggling to merge together, i know there can not be 2 on the same page, could I get a hand merging them onto the same event?

The purpose of this code is to copy and paste any values in sheet 1 typed in the b from tow 5 onwards column onto sheet 2 in the b column from row 5 onwards.
**********************************************************************
Private Sub Worksheet_Change(ByVal Target As Range)

' Exit if multiple cells updated at once
If Target.CountLarge > 1 Then Exit Sub

' See if update in column B after row 4
If Target.Column = 2 And Target.Row > 4 Then
Sheets("Sheet2").Range(Target.Address).Value = Target.Value
End If

End Sub
***********************************************************************
The purpose of this one is to sort all rows from B4 through to AA2000 from the value in K
***********************************************************************
Private Sub Worksheet_Change(ByVal Target As Range)
Range("B4:AA2000").Sort Key1:=Range("K4:K2000"), _
Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
End Sub
***********************************************************************

Sorry.. amateur hour here. I got help from the forum for one of them and i've found the 2nd code online and adjusted it for what i need. just cant seem to merge them haha
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Good to hear you got the solution.

If you would like to post the solution then it is perfectly fine to mark your post as the solution to help future readers. Otherwise, please do not mark a post that doesn't contain a solution.
 
Upvote 0

Forum statistics

Threads
1,215,241
Messages
6,123,823
Members
449,127
Latest member
Cyko

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