Insert data before Offset

Livin404

Well-known Member
Joined
Jan 7, 2019
Messages
743
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I'm trying to add data "DATE:" to an offset in a formula. The end result would be "DATE: WEDNESDAY NOVEMBER 18 2020".

For briefness I only included a couple of lines which I believe where the edit should go. I tried using different variations of adding this piece
Excel Formula:
.Resize(1).Offset(-1).Value = "DATE:"
with "&", and it either errored out or inserted "DATE:" and ignored the actual date.

VBA Code:
For x = .Areas.Count To 1 Step -1
      If x > 1 Then .Areas(x)(1).EntireRow.Insert
      With .Areas(x)
        .Resize(1).Offset(-1).Value = .Value
         .Resize(1).Offset(-1).Replace "(*", Year(Now), xlPart, , , , False, False
        .Resize(1).Value = "DESTINATION"
 
Those cells will have data in them. There will always be a minimum of 3 continuous rows. The first row will be the date, the second row will always be "Destination", the third row will starting listing the destinations and that varies. If there are no departures then I have a code to put in "NO DEPARTURES" in the row beneath the destination.
 
Upvote 0

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
In that case try
VBA Code:
.Resize(1).Offset(-1).Value = "DATE: " & .Resize(1).Value
 
Upvote 0
Solution

Forum statistics

Threads
1,213,546
Messages
6,114,256
Members
448,557
Latest member
richa mishra

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
Back
Top