Advice to merge two codes

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,199
Office Version
  1. 2007
Platform
  1. Windows
Hi,

I wish to run these two codes when i open the worksheet MC LIST.


Code:
Private Sub Worksheet_Activate()    Range("A6").Select
    Range("A4:G4").Font.Size = 24
    Range("A6:G40").Font.Size = 18
    Range("A4:G40").Font.Bold = True
    Range("A4:G40").Font.ColorIndex = 1
    Range("A4:G40").Borders.LineStyle = xlContinuous
    Range("A1:G4").Interior.ColorIndex = 4
    Range("A6:G40").Interior.ColorIndex = 6
    Range("A4:G40").Name = "Calibri"
    Range("A4:G5").RowHeight = 36
    Range("A6:G40").RowHeight = 30


End Sub

I wish to add this piece to it also if you could advise me.

Code:
    Dim x As Long    
    Application.ScreenUpdating = False
    
    With Sheets("MC LIST")
        If .AutoFilterMode Then .AutoFilterMode = False
        x = .Cells(.Rows.Count, 1).End(xlUp).Row
        
        .Range("A6:G" & x).Sort key1:=Range("A6"), order1:=xlAscending, Header:=xlGuess
        
    End With
                      
    ActiveWorkbook.Save
    
    Application.ScreenUpdating = True
    Sheets("MC LIST").Range("A4").Select

Have a nice day.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Hello,

Can you not just put the second piece of code just before the End Sub on the first piece of code. I did that and didn't get any debug error. Not sure what you are trying to achieve though.
 
Upvote 0

Forum statistics

Threads
1,213,537
Messages
6,114,216
Members
448,554
Latest member
Gleisner2

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