Bir Na
asked on
Create a list of Worksheets based on Cell Value
Dear Experts:
i need an VBA to create list of Worksheets based on cell "A31" from Sheet 120 and cell "A29" from Sheet 121. If "Reporting Population: Non-Charged Off Accounts" exist in worksheet then add to the list in "Sheet3".
Please not that i have 121 sheets, i added two sheet for example.
Help is much appreciated.
Thank you very much in advance.
Regards, Bir NA
Book1.xlsx
i need an VBA to create list of Worksheets based on cell "A31" from Sheet 120 and cell "A29" from Sheet 121. If "Reporting Population: Non-Charged Off Accounts" exist in worksheet then add to the list in "Sheet3".
Please not that i have 121 sheets, i added two sheet for example.
Help is much appreciated.
Thank you very much in advance.
Regards, Bir NA
Book1.xlsx
ASKER
HI, thanks for your answer, the VBA works. Unfortunately i have 123 Sheets, just didn't attached entire file.
can we use cell range instead of this: If Sheets(i).Cells(31, 1).Value = "Reporting Population: Non-Charged Off Accounts"
something like Sheets(i).Cells(A29:A31)
Regards, Bir NA
can we use cell range instead of this: If Sheets(i).Cells(31, 1).Value = "Reporting Population: Non-Charged Off Accounts"
something like Sheets(i).Cells(A29:A31)
Regards, Bir NA
Will that be in Column A?
Also send me one more sheet without matching cells
ASKER
@Will that be in Column A? - YES
@Also send me one more sheet without matching cells - FILE attached
Book2.xlsx
@Also send me one more sheet without matching cells - FILE attached
Book2.xlsx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi. the VBA works, Thank you very much
now im trying to do the same for CELL D32 value "Not Applicable" (Book1.xlsx) i updated the VBA but no results.
this is the changes i made
now im trying to do the same for CELL D32 value "Not Applicable" (Book1.xlsx) i updated the VBA but no results.
this is the changes i made
For i = 1 To xWs
If Sheets(i).Name <> DataSh.Name Then
For d = 26 To 40
If Sheets(i).Cells(d, 1).Value = "Not Applicable" Then
DataSh.Range("[D" & i) = Sheets(i).Name
End If
Next d
LOL.
a doesn't stands for Col A. That was just variable I used.
You want to include both the condition together? If Col A has string "Reporting Population: Non-Charged Off Accounts" & Col D has string "Not Applicable"?
a doesn't stands for Col A. That was just variable I used.
You want to include both the condition together? If Col A has string "Reporting Population: Non-Charged Off Accounts" & Col D has string "Not Applicable"?
If you are trying different condition, change as below:
For i = 1 To xWs
If Sheets(i).Name <> DataSh.Name Then
For a = 20 To 40
If Sheets(i).Cells(a, 4).Value = "Not Applicable" Then
DataSh.Range("A" & i) = Sheets(i).Name
End If
Next a
End If
Next i
ASKER
I need two:
1. If Col A has string "Reporting Population: Non-Charged Off Accounts" & Col D has string "Not Applicable"
2. Col D has string "Not Applicable" only
1. If Col A has string "Reporting Population: Non-Charged Off Accounts" & Col D has string "Not Applicable"
2. Col D has string "Not Applicable" only
Hi Bir,
If provided solution worked for you, I would request you to please close this question and open new question if any new changes required.
If provided solution worked for you, I would request you to please close this question and open new question if any new changes required.
ASKER
The VBA which have been provided, solved my problem.
Thanks for help
Thanks for help
Thanks Bir.
Post your new question link here, I will have a look.
Post your new question link here, I will have a look.
Try below, hope you are referring to only those two cells as above A31 & A29.
Open in new window