Data Extraction (without autofilter)

jaypatel

Active Member
Joined
Nov 25, 2002
Messages
389
Hi all,

I have 2 worksheets: Extraction and Dataset.

On the extraction sheet (where I want the data to be presented), if cell A1= "7500-2018", I want to extract from the dataset worksheet anything with 7500-2018 in column A. Within Dataset, I would want columns A to L copied across, if Extraction!A1=Dataset!A:A....

The reason why I don't wish to have autofilter, it contains salary information which I do not want the user to see.

Many thanks in advance

Jay
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
"if Extraction!A1=Dataset!A:A...." can you give more details !!
 
Upvote 0
Is there formulas, format to copy or just the values ?
 
Upvote 0
For the first part of the specification try
Code:
Option Explicit
Sub Copy()
Const DstWsName As String = "Extraction"
Const OrgWsName As String = "Dataset"
Const WkCol As String = "A"
Dim I As Integer, LR As Integer
Dim WkKey  As String
Dim OrgWs As Worksheet, DstWs As Worksheet


    Set OrgWs = Sheets(OrgWsName)
    Set DstWs = Sheets(DstWsName)
    WkKey = DstWs.Cells(1, WkCol)
    With OrgWs
        LR = .Cells(Rows.Count, WkCol).End(3).Row
        For I = 1 To LR
            If (.Cells(I, WkCol) = WkKey) Then
                .Rows(I).Copy DstWs.Cells(Rows.Count, 1).End(3)(2)
            End If
        Next
    End With
End Sub
 
Upvote 0
"if Extraction!A1=Dataset!A:A...." can you give more details !!

okay, so if cell a1 on dataset = cell a1 on extraction, then copy A1:L1

if cell a2 on dataset does not equal a1 on extraction, then do not copy A2:L2
if cell a3 on dataset = cell a1 on extraction, then copy A3:L3

hope this makes sense....

thanks
 
Upvote 0
OKAY, so the code sent is enough ...!
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,304
Members
452,633
Latest member
DougMo

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