Actions without Macro

HappyChappy

Active Member
Joined
Jan 26, 2013
Messages
384
Office Version
  1. 2019
  2. 2010
  3. 2007
Platform
  1. Windows
Hi was wondering can i setup a spread sheet to delete a column of data if one of them coloums is missing say a certain name ie "fred Smith"
and also can it delete whole sheets from the workbook when a certain date is reached

all without the use of a macro.

Regards

Mark
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Short answer is no !!
You will need a macro.
 
Upvote 0
Cheers
would it need to be a complex Marco to achieve what i'm after
 
Upvote 0
No....the macro recorder could do the deletions, but the rest would have to be written.
Do you need assistance to do that ??
 
Upvote 0
i'm afraid i do if that's possible been away from exel for a few years and just starting to use it again it's harder to remember then i thought it would be.
 
Upvote 0
MAybe something like this...checks Sheet1 for "Fred Smith" and deletes Sheet2....you can modify to suit


Code:
option compare text
Sub workbook_open()
If Date >= #6/30/2019# Then
    Dim ws As Worksheet, lc As Long, lr As Long, r As Long, n As Long, c As Long
    Set ws = Sheets("Sheet1")
    lr = ws.Cells.Find("*", , xlValues, , xlRows, xlPrevious).Row
    lc = ws.Cells.Find("*", , xlValues, , xlByColumns, xlPrevious).Column
    n = 0
     With ws
     For c = 1 To lc
            For r = lr To 1 Step -1
                If .Cells(r, c).Value = "Fred Smith" Then
                    n = n + 1
                End If
            Next r
            If n = 0 Then .Columns(c).EntireColumn.Delete
            n = 0
        Next c
    End With
    Application.DisplayAlerts = False
    Sheets("Sheet2").Delete
    Application.DisplayAlerts = True
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,754
Messages
6,180,749
Members
452,996
Latest member
nelsonsix66

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