Try this

 

Sub Extract()

    Dim rng As Range

    Dim cell As Range

    Dim iCounter As Integer

    Dim Rng2 As Range

    Dim cell2 As Range

            Range("A:A").Copy Range("E1")

            Range("E:E").Select

            Selection.RemoveDuplicates 1

            

            Set rng = Range("E2:E" & Range("E65536").End(xlUp).Row)

            Set Rng2 = Range("A2:A" & Range("A65536").End(xlUp).Row)

            

            i = 1

            For Each cell In rng

                        For Each cell2 In Rng2

                        If cell2.Value = cell.Value Then

                            cell.Offset(0, i).Value = cell2.Offset(0,
1).Value

                            i = i + 1

                        End If

                        Next

                        i = 1

            Next

End Sub

 

From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com]
On Behalf Of Raghavendra
Sent: Friday, August 05, 2011 4:58 PM
To: excel-macros@googlegroups.com
Subject: $$Excel-Macros$$ VBA Code to extract data in row

 

Hi ,

 

Can anyone suggest me VBA code to perform task as mentioned in the attached
file.

 

Regards,

Raghavendra

 

-- 
----------------------------------------------------------------------------
------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links :
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com

To post to this group, send email to excel-macros@googlegroups.com
 
<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel

Attachment: Copy of Data Extract.xlsm
Description: application/vnd.ms-excel.sheet.macroenabled.12

Reply via email to