Posts by dxstudios
-
-
Code
Display MoreSub LoopThroughFolder() Dim MyFile As String, Str As String, Wb As Workbook Dim Rws As Long, rng As Range '-------------------- Dim sh As Worksheet Dim c As Range, ws As Worksheet Dim s As String, x Dim MyDir As String, fn As String, i As Long, e, flg As Boolean With Application.FileDialog(msoFileDialogFolderPicker) If .Show Then MyDir = .SelectedItems(1) & "\" End With If MyDir = "" Then Exit Sub '--------------------- Set Wb = ThisWorkbook 'change the address to suite 'MyDir = "C:\Users\davem\OneDrive\Excel Examples\not req\" MyFile = Dir(MyDir & "*.xlsx") 'change file extension ChDir MyDir Application.ScreenUpdating = False Application.DisplayAlerts = False Do While MyFile <> "" Workbooks.Open (MyFile) '----------------------- Set ws = Sheets("START") With ws Rws = .Cells(Rows.Count, "E").End(xlUp).Row Set rng = Range(.Cells(2, "E"), .Cells(Rws, "E")) For Each c In rng.Cells If c Like "*Proceed*" Then c.EntireRow.Interior.ColorIndex = 16 End If Next c For Each sh In Sheets s = sh.Name If sh.Name <> ws.Name Then x = Application.WorksheetFunction.CountIf(ws.Range("B:B"), s) If x = 0 Then sh.Delete End If Next sh '---------------------------- ActiveWorkbook.Close True End With MyFile = Dir() Loop MsgBox "Unwanted Sheets Removed from All files!" End Sub
-
I answered almost the same question for you, that code needs adapting. I f you want to learn VBA then have a go.
Sir, i m sorry , i m very new to VBA coding.....just started learning by recording & playing back the macros...
then learning from your solution threads, your comment in codes are helpfull to me.....
due to some office worloads i cant learn it full time
i hope in somedays i will learn & try on my own....Thank you Sir
-
Thank you Sir, it worked perfectly
it helps me a lot for my learning.
-
Hi friends,
i have a folder with bulk files in it, Here my task is
STEP1: I need to open each & every file & check the sheet name called START, in this sheet E column cells contains text as PROCEED & also other texts,
i just need this entire row to be highlighted if the cell contains word PROCEED.
STEP2:
Then i need to go for B column in same sheet &
here B column contains the sheet names (sheetA,sheetB,sheet1....etc)
as per the sheet names in B column, the workbook also contains the sheets in the same names.
Now i need to keep the sheets, only which are highlighted in above STEP1, rest all sheets can be deleted.
Now the same process has to be repeated for the entire files in that folder.
for better understanding i have attached the sample workbooks & manually higlighted some ROWS
also changed the sheet name in RED, which are need & rest all to be deleted.
i know its a big ask, but i m requesting some experts to help me.
Thanks in Advance.not req.zip
-
-
Worked Like a Charm
Just Saying Thank You will never repay your kindness Sir.
i really appreciate your patience in replying to all threads posted in this forum
can you please share your Webpage link Sir.
-
Sir, code almost working fine on all the files, only below things to be added to it.
1) if i need to add one more word to check , like "Not Required" & "TAT"(this one is newly added)...How to do that sir?
2) some of the sheet names are slightly different, instead of "START" it is updated as "START "
a blank space at the end of sheet names making some troubles, is it possible to remove spaces at the end of sheet name.
FYI...this sheet name (START) always comes at first position.
Excuse me Sir ..if i m going very lengthy.... can i start the above request in a new post ?
-
i m extremely sorry for Disturbing you in middle of your work Sir,
i tried with the updated code, now no error appears, just running til the end, but there is no changes in any of the workbooks,
i m attaching the folder for your reciew Sir.
-
i tried with the updated code also......getting stopped at the location of
sorry, i m getting error at this location
-
-
Are the sheets always in the same position i.e. the first sheet n the workbook?
Yes Sir, the sheet always comes in the first position.
-
Hi Sir,
Few things to get clarified.....
1) if i need to add one more word to check , like "Not Required" & "Not checked"...How to do that?
2) some of the sheet names are slightly different, instead of "START" it is updated as "START "
a space at the last makes the code to get stopped there...please help me to resolve it Sir
-
Awesome Sir, Now it worked perfectly as expected
Thank you so much for your Help Sir
-
my badluck
nothing happening Sir,
Just a message window appear & says "Done" but nothing gets changes in workbooks
Please have a look on it Sir.
-
Yes i tried change the extension Sir, still the same issue...its opening the first file from the path & getting stopped.
attaching the folder.not req.zipnot req.zip
-
Sir, i have tried with your code, but its not happening, its opening the first file from the path & getting stopped.
could you please have a look on it.
Code
Display MoreSub DeleteRows() Dim wbOpen As Workbook, wbNew As Workbook Dim rCl As Range ''/// Change Path Const strPath As String = "C:\Users\x\not req\" Dim strExtension As String With Application .ScreenUpdating = False .Calculation = xlCalculationManual On Error GoTo exit_proc ChDir strPath 'Change extension strExtension = Dir("*.xlsx*") Do While strExtension <> "" Set wbOpen = Workbooks.Open(strPath & strExtension) With wbOpen.Sheets("START") Set rCl = .Cells.Find(What:="*Not Required*", After:=ActiveCell, LookIn:=xlFormulas2, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False) If Not rCl Is Nothing Then .Range(rCl, .Cells(.Rows.Count, 2).End(xlUp)).EntireRow.Delete .Close SaveChanges:=False End With strExtension = Dir Loop exit_proc: .ScreenUpdating = True .Calculation = xlCalculationAutomatic End With End Sub
-
Hi Ozgrid Friends,
i m on seeking help regarding a manual task which i am doing..
here my task is like....i have Folder, which contains many workbooks, each workbook contains a
sheet called START, here in this START sheet, i need to checkout the B column
for the specific Word/ Approximate match "Not Required:"
if this word comes in B column, including that ROW & below ROWS has to be deleted from that sheet.
the same has to be done for all the workbooks in that folder.
in the attached sample workbook i have highlighed the ROWS in yellow, which has to be deleted.
Requesting someone Expert to help me on this Task.sample book.xlsx