Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 03-30-2018, 12:20 PM
p45cal's Avatar
p45cal p45cal is offline Need Macro to Move Text in a Row Windows 10 Need Macro to Move Text in a Row Office 2010 32bit
Expert
 
Join Date: Apr 2014
Posts: 956
p45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond repute
Default

a guess:
Code:
Sub blah()
ActiveSheet.Range("A:H").AutoFilter Field:=3, Criteria1:="ANNUAL LEAVE REGULAR HOURS"
Set DataBody = Intersect(ActiveSheet.AutoFilter.Range, ActiveSheet.AutoFilter.Range.Offset(1))
Set AnnHrs = DataBody.Columns(3).SpecialCells(xlCellTypeVisible)
ActiveSheet.Range("A:H").AutoFilter Field:=3, Criteria1:="SICK LEAVE   REGULAR HOURS"
Set SicHrs = DataBody.Columns(3).SpecialCells(xlCellTypeVisible)
DataBody.AutoFilter
Set CellFirst = SicHrs.Cells(1)
For Each cll In SicHrs.Cells
  Set CellsToCopy = Nothing
  Set CellsToCopy = Intersect(AnnHrs, Range(CellFirst.Offset(1), cll.Offset(-1)))
  If Not CellsToCopy Is Nothing Then
    CellsToCopy.Cells(1).Resize(, 6).Copy CellFirst.Offset(, 10)
    CellsToCopy.Cells(1).Resize(, 6).ClearContents
    If CellsToCopy.Cells.Count > 1 Then
      CellsToCopy.Select
      MsgBox "More than one row to copy! Only the first of the selected cells' rows has been moved."
    End If
  End If
  Set CellFirst = cll
Next cll
End Sub
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
macro to move cells ewso Excel Programming 1 10-11-2017 12:23 AM
Need Macro to Move Text in a Row A macro to find a symbol, delete it, and move the cursor to that location JayBird24 Word VBA 1 08-19-2016 04:26 PM
How to move data - Macro not working ecarter312 Excel Programming 1 08-10-2016 11:26 PM
Need Macro to Move Text in a Row Macro to move focus after entry in a cell Phil H Excel Programming 3 06-18-2015 01:20 PM
Macro - Can I move information from a website and excel to word? redzan Word VBA 1 03-13-2013 07:39 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:30 AM.


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