Howard Cohen
Member
Members
Forum Posts: 56
Member Since:
December 8, 2016
December 8, 2016
Offline
I have a file that I want to import the data that have been coloured using Conditional formatting
I have code to open a file, but need this amended to only copy the data that has been coloured containing conditional formatting
Your assistance in resolving this is most appreciated
Sub Open_and_CopyFile() ' Application.ScreenUpdating = False Application.EnableEvents = False Application.Calculation = xlCalculationManual Application.DisplayAlerts = False Dim nb As Workbook, ts As Worksheet, A As Variant Dim rngDestination As Range Sheets(1).Select Set ts = ActiveSheet On Error Resume Next Set rngDestination = ts.[A1] On Error GoTo 0 If rngDestination Is Nothing Then Exit Sub ChDir ("C:\my Documents") With Application.FileDialog(msoFileDialogFilePicker) .InitialFileName = "*Conditional*.xls*" If .Show = 0 Then Exit Sub A = .SelectedItems(1) End With ' A = Application.GetOpenFilename ' If A = False Or IsEmpty(A) Then Exit Sub Application.ScreenUpdating = False Set nb = Workbooks.Open(A) ThisWorkbook.Activate nb.Sheets(1).Range("A3:D50").Copy rngDestination.PasteSpecial Paste:=xlPasteValues rngDestination.PasteSpecial Paste:=xlPasteFormats Application.CutCopyMode = False nb.Close savechanges:=False Application.ScreenUpdating = True Application.EnableEvents = True Application.Calculation = xlCalculationAutomatic Application.DisplayAlerts = False End SubI have also posted on Macro to import data containing Conditional formatting (excelforum.com)
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Riny van Eekelen
Guest(s) 9
Currently Browsing this Page:
1 Guest(s)
1 Guest(s)
Top Posters:
Catalin Bombea: 1939
SunnyKow: 1432
Anders Sehlstedt: 919
Purfleet: 415
Frans Visser: 349
Hans Hallebeek: 339
David_Ng: 306
lea cohen: 248
Jessica Stewart: 219
A.Maurizio: 216
Newest Members:
Drew Smith
Michael Denton
Nick Pascal
David Webb
Johannes Bruentrup
John Jay
Larry Silverman
David Rousseau
Melinda Heidemann
Jose Fuentes
Forum Stats:
Groups: 3
Forums: 25
Topics: 7073
Posts: 30998
Member Stats:
Guest Posters: 49
Members: 34470
Moderators: 2
Admins: 3
Administrators: Mynda Treacy, Philip Treacy, Jessica
Moderators: Velouria, Riny van Eekelen
© Simple:Press —