Elastomers
New Member
- Joined
- Jul 5, 2022
- Messages
- 1
- Office Version
- 365
- Platform
- 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
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