Color and Fonts changing when worksheet is pulled into active workbook

rikvny02

Board Regular
Joined
Aug 9, 2022
Messages
78
Office Version
  1. 365
Platform
  1. Windows
The macro below pulls a worksheet from a folder and places it within my active workbook. Oddly when this happens FONTS and COLORS change for no reason. Can anyone think of why this is happening?




Sub copy_worksheet_para()

Application.ScreenUpdating = False
Dim wbk1 As Workbook, wbk2 As Workbook

'add your own file path
fileStr = "s:\payroll\time\daily info.xlsm"

Set wbk1 = ActiveWorkbook
Set wbk2 = Workbooks.Add(fileStr)


wbk2.Sheets("daily info").Copy after:=wbk1.Sheets(2)
wbk2.Close SaveChanges:=False

End Sub
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Does the workbook you are copying the information into contain any Conditional Formatting, or any other VBA code?
Or does it use a font which is not available in the workbook you are copying into?
 
Upvote 0
Does the workbook you are copying the information into contain any Conditional Formatting, or any other VBA code?
Or does it use a font which is not available in the workbook you are copying into

The workbook does contain conditional formatting and also VBA. Its just weird because this just started happening recently. I have an almost exact copy of the transferring file and that copy keeps its format without fail.
 
Upvote 0
In the workbook where it is changing, check the Conditional Formatting of those cells, as well as the automated VBA code in the ThisWorkbook and Sheet modules.
 
Upvote 0
In the workbook where it is changing, check the Conditional Formatting of those cells, as well as the automated VBA code in the ThisWorkbook and Sheet modules.
looks as if another employee has changed the Table format throughout the workbook and this is causing the issue. Thanks for your help.
 
Upvote 0
Solution
You are welcome.
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,958
Members
449,096
Latest member
Anshu121

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