Clear selected cell and change the content of those around it.

Nyge2k3

New Member
Joined
Feb 16, 2015
Messages
8
Can anyone help me with this? I'm sure there's a simple macro for it, but I'm not very good with them unless I'm recording. Basically, I'm doing staff rotas and looking for an easy way to show someone on leave. I could need to change many at the same time, so I'm looking for a bit of a time saver. So.....

Currently (Where selected Cell = A1):

A1 = 06:30
A2 = 13:30
A3 = 07:00
A4 = 07:00
A5 = BLANK
A6 = "TEXT"
A7 = "TEXT"

I want to change it to:

A1 = BLANK
A2 = BLANK
A3 = "00:00"
A4 = BLANK
A5 = "Leave"
A6 = BLANK
A7 = BLANK

Many thanks for any help
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Those same 7 cells would get those same values every time the code runs? You could loop over an array of those values in the order you need
e.g. For i = 1 to 7
and in the same loop, set "A" & i to the value retrieved by array(i)
 
Upvote 0
Hi, thanks for the help.

I found this as the solution.

ActiveCell.Select
Selection.ClearContents
ActiveCell.Offset(1).Select
Selection.ClearContents
ActiveCell.Offset(2).Select
Selection.ClearContents
ActiveCell.Offset(1).Select
ActiveCell.FormulaR1C1 = "PL"
ActiveCell.Offset(1).Select
Selection.ClearContents
ActiveCell.Offset(1).Select
Selection.ClearContents

End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,214,974
Messages
6,122,536
Members
449,088
Latest member
RandomExceller01

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