Imported PDF data clears all highlighted cells when refreshed

Elastomers

New Member
Joined
Jul 5, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi all,
New to this....... I have a spreadsheet with multiple pages for employee job sheets. I import PDF orders to excel using power query, the data is automatically imported to the spreadsheet. Employees highlight completed jobs on their worksheets Green, I highlight them Red when ready for dispatch, Upon highlighting Red I press a button with macro to delete this and any other folders colored red from their selected directory. This all works fine but when I import an new PDF order form, it clears any previously highlighted green cells that are not read y for dispatch at this point in time, any help is greatly appreciated. Example below

Sub DeleteFiles()
Dim MyFolder As String
Dim MyFile As String
Dim cell As Variant
Dim source As Range

MyFolder = Sheets("Ben's Orders").Range("J1").Value & "\"
Set source = Range("A2:A100")

For Each cell In source
If cell.Interior.Color = vbRed Then
MyFile = MyFolder & cell.Value
If Dir(MyFile) <> "" Then
Kill MyFile



End If
End If
Next
Clear_ValuesRed
End Sub

Sub Clear_ValuesRed()

Application.ScreenUpdating = False

Dim Myrange As Range, cel As Range

Set Myrange = Range("A1:Z100")

For Each cel In Myrange

If cel.Interior.ColorIndex = 3 Then

cel.Interior.ColorIndex = 0

End If

Next cel

Application.ScreenUpdating = True

End Sub
1656996261190.png
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,214,932
Messages
6,122,332
Members
449,077
Latest member
jmsotelo

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