adding cells to selection

kl88

New Member
Joined
Jun 30, 2011
Messages
15
Hello !

Im having a slight problem with a macro of mine. Normally i would fool around with it till i get it right but since its one of my last days here i have to be quick. So hopefully someone here can help !

im trying to create a macro which will select all the results of codes that come out once i use a filter function. Since i dont know how many codes are going to be coming out the macro has to be quite variable.

This is what i have so far
Code:
Sub Macro3()
'
' Macro3 Macro
'
    On Error Resume Next
    Set wSheet = Sheets("Name")
        If wSheet Is Nothing Then 'Doesn't exist
        Set wSheet = Nothing
        On Error GoTo 0
        Else 'Does exist
    ActiveSheet.Range("$B$1:$BC$12").AutoFilter Field:=25, Criteria1:= _
        "Name"
    ActiveSheet.Range("$B$1:$BC$12").AutoFilter Field:=24, Criteria1:= _
        "Retour aanvrager gestuurd."
    
    Set rRange = Range("B2", Range("B65536").End(xlUp).Offset(1)).Select
    Selection.SpecialCells(xlCellTypeVisible).Select
    If Selection.Cells.Count < 1 Then
    Exit Sub
    Else
    ActiveRow = ActiveCell.Row 'gets row address of active cell
    Range(Cells(ActiveRow, 2), Cells(ActiveRow, 24)).Select

All i get now are the codes i get in column B , but in column C to Z is also information that needs to be copied into the new sheet. But i cant seem to find a way to broaden the selection. Hope someone out here knows !

Any help is appreciated !
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Perhaps

Code:
Selection.SpecialCells(xlCellTypeVisible).Resize(, 25).Select
 
Upvote 0

Forum statistics

Threads
1,224,505
Messages
6,179,153
Members
452,891
Latest member
JUSTOUTOFMYREACH

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