copy date from one column to another minus one day and copy to end of data set

fvisions

Board Regular
Joined
Jul 29, 2008
Messages
184
Office Version
  1. 365
Platform
  1. Windows
Last to rows of this code below I added from a marco test but get a error 438 - Object doesnt support this property or method.
What I am attempting to do is in col E = col J-1 Column J is a start date and column E is the end date so 2/22/21 start date = 2/21/21 end date. Can yo help me with what I am missing?

VBA Code:
Dim sh As Worksheet
Set sh = Sheets("Installation wkg")
Worksheets("Installation wkg").Range("A1").AutoFilter Field:=13, Criteria1:="MUSL"

Dim LastRow As Long
LastRow = Sheets("Installation wkg").Cells(Rows.Count, 2).End(xlUp).Row
Application.ScreenUpdating = False
 
With Sheets("ADD & END Operand Mode2 Delivry")
   Sheets("Installation wkg").Range("H2:H" & LastRow).Copy Destination:=.Range("B3")
   Sheets("Installation wkg").Range("I2:I" & LastRow).Copy Destination:=.Range("C3")
   Sheets("Installation wkg").Range("K2:K" & LastRow).Copy Destination:=.Range("D3")
   Sheets("Installation wkg").Range("W2:W" & LastRow).Copy Destination:=.Range("I3")
   Sheets("Installation wkg").Range("AA2:AA" & LastRow).Copy Destination:=.Range("M3")
   Sheets("Installation wkg").Range("X2:X" & LastRow).Copy Destination:=.Range("J3")
   
   .Columns("J:J").NumberFormat = "mm/dd/yyyy"
   .Columns("E:E").NumberFormat = "mm/dd/yyyy"
   .Range("A2").AutoFill .Range("A2:A" & LastRow + 1)
   .Range("F2").AutoFill .Range("F2:F" & LastRow + 1)
.Range("E3").ActiveCell.FormulaR1C1 = "=RC[5]-1"
   .Range("E3").AutoFill .Range("E3:E" & LastRow + 1)
 

Some videos you may like

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,231
Office Version
  1. 365
Platform
  1. Windows
Remove the "ActiveCell" from the penultimate line.
 
Solution

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,231
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback.
 

Watch MrExcel Video

Forum statistics

Threads
1,126,953
Messages
5,621,802
Members
415,857
Latest member
braunReivn

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top