Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 04-21-2018, 09:04 AM
NoSparks NoSparks is offline Copy worksheet with current date as part of variable name Windows 7 64bit Copy worksheet with current date as part of variable name Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

This of any help?
You could apply the required "adjustments" after this.
Code:
Sub GetPlanStatus()
        
    Dim wb As Workbook, src As Workbook
    Dim sht As Worksheet, cel As Range
    
Set sht = ThisWorkbook.ActiveSheet
'remove existing data
With sht.UsedRange.Offset(1)
    .Borders.LineStyle = xlNone
    .ClearContents
End With
'see if source is open
For Each wb In Application.Workbooks
    If wb.Name = "SearchResultsDaily " & Format(Date, "m.dd.yy") & ".xls" Then
        Set src = wb
        Exit For
    End If
Next wb
'if yes copy data
If Not src Is Nothing Then
    src.Sheets(1).UsedRange.Offset(1).Copy
'if no display message and quit
Else
    MsgBox "Workbook   " & Chr(34) & "SearchResultsDaily " & _
            Format(Date, "m.dd.yy") & ".xls" & Chr(34) & "   is not open."
    Exit Sub
End If
'paste the copied data
With sht
    .Cells(2, 1).PasteSpecial (xlPasteValues)
    'name sheet
    .Name = Left(src.Name, Len(src.Name) - 4)
    ' E from F if blank
    For Each cel In Intersect(.Columns("E"), .UsedRange)
        If cel.Value = "" Then cel.Value = cel.Offset(, 1).Value
    Next cel
    'position the cursor
    .Cells(1).Select
End With
'stop the marching ants
Application.CutCopyMode = False

End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting a Worksheet Name as a Variable Help rod147 Excel Programming 3 11-25-2016 08:50 AM
Copy worksheet with current date as part of variable name Date picker content control to always show current date. lucky16 Word VBA 2 07-01-2016 01:14 PM
Variable to rename a tab in a worksheet via VBA Chayes Excel Programming 5 08-07-2012 02:03 AM
Copy worksheet with current date as part of variable name Meaning of current date vs status date when saving baselines ketanco Project 1 02-08-2012 02:20 PM
Copy worksheet with current date as part of variable name How to call current PC date and/or current PC year KIM SOLIS Excel 2 11-04-2011 06:09 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:33 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft