hello guys-I am trying to make this loop run a certain way. I have posted it. any help is appreciated.
![]()
Please Login or Register to view this content.
hello guys-I am trying to make this loop run a certain way. I have posted it. any help is appreciated.
![]()
Please Login or Register to view this content.
The best way to improve your loop is to get rid of it.
In Pseudocode:
Copy all your data to sheet2
Insert a formula in an Empty column to to return a 1 if column A <> Name
Copy Paste Values
Use select Special to select all the 1's in our helper column.
Resize the selection to Delete all your flagged Rows
There is no loop so this should be fast.
![]()
Please Login or Register to view this content.
Last edited by mehmetcik; 04-14-2020 at 04:52 PM.
My General Rules if you want my help. Not aimed at any person in particular:
1. Please Make Requests not demands, none of us get paid here.
2. Check back on your post regularly. I will not return to a post after 4 days.
If it is not important to you then it definitely is not important to me.
Or test such code:
![]()
Please Login or Register to view this content.
Best Regards,
Kaper
EDIT: I have added a sample of attachment of what I am attempting to accomplish
hello kaper- I am testing your suggested code. It is not looping to the next record in this section:
![]()
Please Login or Register to view this content.
Last edited by hgchas; 04-15-2020 at 03:58 PM.
have you seen the yellow banner at the top of the page? Please follow the advice![]()
hi-I have edited the previous reply with a sample attachment.
According to post #4 attachment a VBA beginner starter demonstration :
PHP Code:
Sub Demo1()
Sheet2.UsedRange.Columns(1).Copy Sheet2.[K1]
Sheet1.[C1:D1].Copy Sheet2.[C1]
Sheet1.UsedRange.AdvancedFilter xlFilterCopy, Sheet2.[K1].CurrentRegion, Sheet2.[A1:D1]
Sheet2.[K1].CurrentRegion.Clear
End Sub
The same demonstration revamped :
PHP Code:
Sub Demo1r()
With Sheet2.UsedRange.Columns
.Item(1).Copy .Item(11)
Sheet1.[C1:D1].Copy .Range("C1")
Sheet1.UsedRange.AdvancedFilter xlFilterCopy, .Item(11), .Range("A1:D1")
.Item(11).Clear
End With
End Sub
► Do you like it ? ► ► So thanks to click on bottom left star icon « ★ Add Reputation » ! ◄ ◄
Last edited by Marc L; 04-15-2020 at 11:33 PM.
Hi Marc-thank you for your feedback! I ran the code but I am looking to run a index/match function through each row between two datasets. The first post code worked but only returned one row and I am wanting to loop through the datasets to find commonalities
The example you posted in post #4 is quite different than what has been posted in post #1
Moreover, I suspect that example data is oversimplified (see below for the attachment suggestions), because for such data with unique ID, a simple VLOOKUP would do the job.
Use in C2 in sheet 2:and the same in D2, but with 4 (instead of 3) as third argument.Formula:
Please Login or Register to view this content.
---
1. Make sure that your sample data are truly REPRESENTATIVE of your real data. (If there are typical cases like: all unique values/duplicates could occur, day/night, nobody present/several persons at once, before/on/past due, empty cells between data, mixed text/numbers, etc. - please show them all, or at least indicate in text). The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.
2. Make sure that your desired solution(s) is/are also shown (mock up the results manually).
3. Make sure that all confidential/restricted information (either personal or business) like real e-mails, social security numbers, bank accounts, etc. is removed first!!
On my side my codes well work, return all the expected data according to your post #4 attachment …
hi-I have attached a workbook with sample data. I used the index/match function to show what I am wanting to accomplish. thanks in advance!
That's very weird to attach a sample with a different layout than the original (post #4)
or you must be very confident with your Excel / VBA skills to amend any code !
According to the last attachment, explain the actual layout of Sheet2,
as there is no formula what exactly to do, attach the expected result, it may help, a lot …
hi marc-thanks for the feedback, I appreciate it! I have attached a different working sample with more data to reflect what I am wanting to accomplish. I hope I can convey what I am trying to do.
This works when the keys are properly entered - In your sample there were 3 East 95's for instance.
But try it and see whether it works for you:
![]()
Please Login or Register to view this content.
Last edited by xladept; 04-18-2020 at 12:05 AM.
If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)
You can't do one thing. XLAdept
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks