I only have a very basic knowledge of Excel but how can I delete empty cells and shift them to the left?
I only have a very basic knowledge of Excel but how can I delete empty cells and shift them to the left?
Hi G,
Welcome to the Forum - try this:
Directions for running the routine(s) just suppliedSub ShiftLeft() Range("J4").Delete Shift:=xlToLeft End Sub
Copy the code to the clipboard
Open your Workbook
Save your Workbook or Another Workbook designated for Macros as Macro_Enabled
Press ALT + F11 to open the Visual Basic Editor.
Select “Module” from the Insert menu
Type "Option Explicit" then paste the code under it
With the cursor between Sub and End Sub press F5 (F8 to Single Step)
OR
Press ALT + Q to close the code window.
Press ALT + F8 then double click on the macro name
If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)
You can't do one thing. XLAdept
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin
Where do I type this?
Hi G,
You can change (see in red) to whatever address you want to delete or you can do it to the active cell:
OrSub ShiftLeft() Range("J4").Delete Shift:=xlToLeft End Sub
Or if you want the program to choose which ones to delete:Sub ShiftLeft() ActiveCell.Delete Shift:=xlToLeft End Sub
Sub ShiftLeft() If ActiveCell="" Then ActiveCell.Delete Shift:=xlToLeft End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks