+ Reply to Thread
Results 1 to 2 of 2

Change from Entirerow to Column range

  1. #1
    Registered User
    Join Date
    12-03-2013
    Location
    bangalore,india
    MS-Off Ver
    Excel 2003
    Posts
    29

    Change from Entirerow to Column range

    Hi Experts,

    I'm struck!!! I have below piece of code that copies entire row while copying from one worksheet to other. I need only selected column in row to be copied.

    Any Help on same is really appreciated

    Function FilterAndCopy(rng As Range, Choice As String)

    Dim FiltRng As Range

    Dim Aname As String
    Aname = ActiveWorkbook.Sheets(1).Range("A1").Value
    Workbooks.Add


    'Clear Contents to show just new search data
    Worksheets("Sheet1").Cells.ClearContents
    'Set the column to filter (In This Case 1 or A)
    'Change as required
    rng.AutoFilter Field:=1, Criteria1:=Choice
    On Error Resume Next
    Set FiltRng = rng.SpecialCells(xlCellTypeVisible).EntireRow
    On Error GoTo 0

    'Copy Data across to sheet 2
    FiltRng.Copy Worksheets("Sheet1").Range("A1")
    'Display Data
    Worksheets("Sheet1").Select
    Range("A1").Select
    Set FiltRng = Nothing

    ActiveWorkbook.SaveAs fileName:=Aname & ".xls"
    ActiveWorkbook.Close
    End Function

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Change from Entirerow to Column range

    Welcome to the forum.

    Pls take some minutes to read forum rules and specially-in this case-rule#3.
    Last edited by Fotis1991; 12-17-2013 at 08:08 AM.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Set the specific column range instead of entirerow
    By satputenandkumar0 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-17-2013, 07:45 AM
  2. [SOLVED] Change/replace vb code .EntireRow.Insert (2007)
    By Excelnoub in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-25-2012, 07:46 AM
  3. Delete EntireRow if the data have different format on the range
    By feroguz in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-21-2012, 01:40 PM
  4. change vba from EntireRow to Column.Range
    By Nogi in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-13-2007, 06:28 AM
  5. If ActiveCell.Font.Bold = True Then ... trying to specify a range, not 'entirerow'
    By Winawer in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-29-2006, 06:08 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1