Results 1 to 18 of 18

VBA Macro: Copy and Paste Specific Row Range based on the Specific Value in a Cell.

Threaded View

SolidSmoke VBA Macro: Copy and Paste... 10-07-2016, 01:23 PM
protonLeah Re: VBA Macro: Copy and Paste... 10-07-2016, 05:23 PM
SolidSmoke Re: VBA Macro: Copy and Paste... 10-08-2016, 02:17 AM
SolidSmoke Re: VBA Macro: Copy and Paste... 10-08-2016, 02:56 AM
JBeaucaire Re: VBA Macro: Copy and Paste... 10-08-2016, 11:18 AM
SolidSmoke Re: VBA Macro: Copy and Paste... 10-08-2016, 01:13 PM
JBeaucaire Re: VBA Macro: Copy and Paste... 10-08-2016, 06:40 PM
SolidSmoke Re: VBA Macro: Copy and Paste... 10-09-2016, 09:50 AM
JBeaucaire Re: VBA Macro: Copy and Paste... 10-09-2016, 11:22 AM
SolidSmoke Re: VBA Macro: Copy and Paste... 10-09-2016, 11:25 AM
SolidSmoke Re: VBA Macro: Copy and Paste... 10-09-2016, 11:34 AM
JBeaucaire Re: VBA Macro: Copy and Paste... 10-10-2016, 02:13 AM
SolidSmoke Re: VBA Macro: Copy and Paste... 10-10-2016, 03:39 AM
SolidSmoke Re: VBA Macro: Copy and Paste... 10-10-2016, 05:54 AM
JBeaucaire Re: VBA Macro: Copy and Paste... 10-10-2016, 10:12 AM
SolidSmoke Re: VBA Macro: Copy and Paste... 10-10-2016, 10:33 AM
JBeaucaire Re: VBA Macro: Copy and Paste... 10-10-2016, 02:32 PM
SolidSmoke Re: VBA Macro: Copy and Paste... 10-10-2016, 02:40 PM
  1. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VBA Macro: Copy and Paste Specific Row Range based on the Specific Value in a Cell.

    This one macro will do it on any sheet that is active when you run the macro. I've changed the name of your main sheet from Sheet1 to Availability. I also tweaked your headers slightly for appearance.

    Option Explicit
    
    Sub DailyAvailability()
    Dim wsMAIN As Worksheet, wsME As Worksheet, meFIND As Range, LR As Long
    
    Set wsMAIN = Sheets("Availability")             'the sheet with the hours
    Set wsME = ActiveSheet                          'the currrent sheet to update
    
    On Error Resume Next
    With wsMAIN
        LR = .Range("A" & .Rows.Count).End(xlUp).Row        'find the last row of availability date
        Set meFIND = .Rows(2).Find(wsME.Name, LookIn:=xlValues, LookAt:=xlWhole)    'find the current day
        If Not meFIND Is Nothing Then                       'if sheetname/day is found, proceed
            wsME.UsedRange.Clear                            'clear prior info
            .AutoFilterMode = False                         'remove prior filters
            .Rows(3).AutoFilter meFIND.Column, "Active"     'filter daily column for "active" only
            .Range("A2:F" & LR).Copy wsME.Range("A2")       'copy name info, then copy hours
            .Range(.Cells(2, meFIND.Column - 2), .Cells(LR, meFIND.Column - 1)).Copy wsME.Range("G2")
            .AutoFilterMode = False
            Application.CutCopyMode = False
            wsME.Columns.AutoFit
        End If
    End With
    
    End Sub
    Attached Files Attached Files
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. macro to copy range hidden paste in a specific location
    By graiggoriz in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-26-2014, 11:27 AM
  2. [SOLVED] Macro to copy specific data from one WB to specific cells in another WB based on specific
    By d_rose in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-26-2014, 11:05 AM
  3. Macro to copy specific line from text file and paste into specific cell in excel
    By keeneye in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-05-2013, 10:35 AM
  4. Copy and paste specific range to date specific range in alternate sheet
    By alanalmarza in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-21-2013, 08:29 AM
  5. macro to copy a range of worksheets based on cell entry and rename specific sheets
    By Lbischoff in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-14-2012, 12:13 PM
  6. HELP! Macro to Copy specific cells from one sheet to another based on specific criteria
    By atriscritti in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-11-2012, 11:05 AM
  7. [SOLVED] Macro - Copy and Paste to a Specific Row based on the input in a cell
    By usc1382 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-22-2012, 05:05 PM
  8. Copy & paste specific column based on cell reference
    By ccsmith in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-26-2011, 03:59 AM

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