Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #8  
Old 04-23-2016, 07:04 AM
jeffreybrown jeffreybrown is offline automating drag & drop Windows Vista automating drag & drop Office 2007
Expert
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default

Okay, this looks for today's date in column A and then pastes the formula in that row converting them to values.

I'm guessing in your original file you did not mean to keep all those formulas in B2:F23
as they would constantly change. So again, this code will copy the formula to the row with today's date and then convert to values.

Code:
Sub Rearrange()
    Dim LR As Long
    Dim Found As Range
    Dim MyFound As Long
    
    Const sFormula As String = "=COUNTIF(Status!$A$2:$A$#, B$1)"
    Const sFormula1 As String = "=COUNTIF(Status!$B$2:$B$#, D$1)"
    
    Set Found = Columns(1).Find(What:=Format(Date, "d-mmm-yy"), LookIn:=xlValues)
    
    MyFound = Found.Row - 1
    
    LR = Sheets("Status").Range("A" & Rows.Count).End(xlUp).Row
    
    Application.ScreenUpdating = False
    
    With Sheets("Data").Range("B" & Found.Row).Resize(, 2)
        .Formula = Replace(sFormula, "#", LR)
        .Value = .Value
    End With
    
    With Sheets("Data").Range("D" & Found.Row).Resize(, 3)
        .Formula = Replace(sFormula1, "#", LR)
        .Value = .Value
    End With
    
    Application.ScreenUpdating = True
End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
automating drag & drop Cannot drag and drop tasks RandWald Outlook 3 04-02-2016 06:45 AM
automating drag & drop Drag and drop macro Amanoo PowerPoint 2 06-15-2012 04:01 AM
Drop and drag macro Jamtart PowerPoint 3 04-15-2012 11:05 PM
Drag and drop contacts christer Office 0 10-03-2011 09:54 AM
Drag & Drop problem nickywave Outlook 0 04-12-2011 01:40 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:03 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