VBA Loop per row

taninda

New Member
Joined
Sep 19, 2016
Messages
3
Hi I recorded the following macro:

Sub Macro2()
'
' Macro2 Macro
'


'
Selection.Copy
Sheets("Data").Select
ActiveSheet.Range("$A$1:$AJ$2958").AutoFilter Field:=19, Criteria1:= _
"114112"
Sheets("Data Source").Select
Range("C2").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=Data!R[2929]C[28]"
Range("C3").Select
End Sub

So on my worksheet: A2= 114112



Now I need the macro to loop for every row. As in, automatically select the number in A3, go look it up in the filter in data tab, grab the appropriate cell and come back and paste in current worksheet.

If someoone could help me out I would really appreciate it.


Thank You!!
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Please tell me what your attempting to do please.
Showing me a script you wrote and then wanting it modified to do what you show here is not something I like doing.
 
Upvote 0
Please tell me what your attempting to do please.
Showing me a script you wrote and then wanting it modified to do what you show here is not something I like doing.


Haha i will try my best.

So I have a sheet with numbers on one column and another column has information associated with the numbers. ( A v-lookup wont work because other columns in the sheet are messing with it).

I have another sheet with just the numbers. I need to extract the info associated with the numbers on this sheet from the other sheet. ex:

Number Info Other Info More Info
1 Cat Black New
1 Cat White Old
1 Cat Red New
3 Dog White Old
4 Fox White Old
5 Cow Purple New
5 Cow Orange Old


I just need "Info". Not Other Info or More info.

Any ideas?
 
Upvote 0
[TABLE="width: 350"]
<tbody>[TR]
[TD]Number[/TD]
[TD]Info[/TD]
[TD]color[/TD]
[TD]age[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]cat[/TD]
[TD]black[/TD]
[TD]old[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]cat[/TD]
[TD]while[/TD]
[TD]new[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]cat[/TD]
[TD]yellow[/TD]
[TD]new[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]dog[/TD]
[TD]brown[/TD]
[TD]new[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]fox[/TD]
[TD]black[/TD]
[TD]new[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]cow[/TD]
[TD]yellow[/TD]
[TD]old[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]cow[/TD]
[TD]grey[/TD]
[TD]old[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Code:
A v-lookup wont work because other columns in the sheet are messing with it

Why won't VLOOKUP work, it seems the obvious choice, given the info provided. ??
AND
What do you mean by "messing with it" ???
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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