VBA for sheet formatting

bosko2

New Member
Joined
Nov 3, 2020
Messages
22
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I have some code that copies filtered data from a hidden sheet to a visible sheet, I'm having trouble with formatting the newly created table/sheet.

I'm not sure if I need to paste in the entire code, I'll start with the part where I'm having trouble, specifically row 1; I would like the text to be bold (at the moment all text on the sheet is bold), and to have a filter applied to row 1:

Rich (BB code):
Dim DbExtract, DuplicateRecords As Worksheet
    Set DbExtract = ThisWorkbook.Sheets("Investigations")
    Set DuplicateRecords = ThisWorkbook.Sheets("My team's investigations")

    Sheets("Safety Accountability Dashboard").Select
    Sheets("Investigations").Visible = True
    Sheets("Investigations").Select
    Sheets("My team's investigations").Visible = True

    DbExtract.Range("A1:BF9999").SpecialCells(xlCellTypeVisible).Copy
    DuplicateRecords.Cells(1, 1).PasteSpecial
  
    Sheets("Investigations").Select
    ActiveWindow.SelectedSheets.Visible = False
    Selection.AutoFilter
    Selection.WrapText = True
    Selection.Font.Bold = True
    Selection.HorizontalAlignment = xlLeft
    Selection.VerticalAlignment = xlVAlignTop


I think there needs to be something between the blue text and the yellow text, because I'm wanting to format the new sheet "My team's investigations", not the reference sheet "Investigations".

Thank you in advance.

Cheers,
Mike
 
Last edited by a moderator:

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
I'm not sure how bump up this post, I'm sure it's an easy for the pros out there/
 
Upvote 0

Forum statistics

Threads
1,214,912
Messages
6,122,204
Members
449,072
Latest member
DW Draft

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