Quicker VBA

Dazzybeeguy

Board Regular
Joined
Jan 6, 2022
Messages
111
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
I have the following which works but just wanted to see if it could be written to be more succinct / make the VBA quicker

VBA Code:
Sub Write_Up_Delete()
'
' Write_Up_Delete Data Macro
'

'
    Application.ScreenUpdating = False
    Range("D5:L5").Select
    Selection.ClearContents
    Range("d8").Value = "Happy "
    Range("D9:L9").Select
    Selection.ClearContents
    Range("D10:L10").Select
    Selection.ClearContents
    Range("d15").Value = "?"
    Selection.ClearContents
    Range("D16:L16").Select
    Selection.ClearContents
    Range("d20").Value = "Well"
    Range("D21:L21").Select
    Selection.ClearContents
    Range("d16").Formula = "=IF(d15 = ""?"",""???"",IF(d15 = ""yes"",""**Insert Ref here**"",""???""))"
    Range("D5:L5").Select
End Sub

Thanks People.
 
Last edited by a moderator:

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Maybe as below:
VBA Code:
Sub Write_Up_Delete()
    Range("D8").Value = "Happy "
    Range("D5:L5,D9:L9,D10:L10,D16:L16,D21:L21").ClearContents
    Range("D15").Value = "?"
    Range("D20").Value = "Well"
    Range("D16").Formula = "=IF(D15 = ""?"",""???"",IF(D15 = ""yes"",""**Insert Ref here**"",""???""))"
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,223,247
Messages
6,171,004
Members
452,374
Latest member
keccles

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