VBA code to select next empty cell in column + actions

DragonPlush

New Member
Joined
Aug 4, 2023
Messages
2
Office Version
  1. 2016
Platform
  1. Windows
So I'm struggling to figure out how to get my VBA macro to work. Basically I need to find a select the next empty cell after U5, Clear the contents of that cell plus the next two columns (V & W) and then merge all three cells in the row.

I've tried using relative references and recording a macro but it has en error every time I try to use it.

Anyone got an idea?
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
What I've got so far is:

VBA Code:
Range.("U7").End(xldown.offset(1,0).select
Selection.clearcontents
But can't get the next two cells in the row and merge them part to work so I just deleted my attempt for now
 
Upvote 0
Welcome to the Board!

Try this:
VBA Code:
    With Range("U5").End(xlDown).Offset(1, 0).Resize(1, 3)
        .ClearContents
        .Merge
        .Select
    End With
 
Upvote 0

Forum statistics

Threads
1,215,071
Messages
6,122,963
Members
449,094
Latest member
Anshu121

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