macro help

bluefeather8989

Active Member
Joined
Nov 20, 2009
Messages
331
Office Version
  1. 365
Platform
  1. Windows
Code:
If C30 = 1 Then
Application.ScreenUpdating = False
Range("C30").Select
    Selection.ClearContents
    Range("A1").Select
ElseIf C30 = "" Then

    Range("C30").Select
    ActiveCell.FormulaR1C1 = "1"
    Range("A1").Select
Application.ScreenUpdating = True
End If

End Sub

it wont work the way i want it to work
if C30=1 then delete C30. if not then insert 1
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
try:
If Range("C30") = 1 Then


Code:
Application.ScreenUpdating = False
If Range("C30") = 1 Then
    Range("C30").ClearContents
ElseIf Range("C30") = "" Then
    Range("C30") = 1
End If
Range("A1").Select
Application.ScreenUpdating = True
 
Upvote 0
Code:
Range("A1").Select
If [C30] = 1 Then
Application.ScreenUpdating = False
    Range("C30").Select
        Selection.ClearContents
    Range("A1").Select
 Application.ScreenUpdating = True
ElseIf [C2] = "" Then
    Range("A1").Select
        Application.ScreenUpdating = False
            Range("C30").Select
        ActiveCell.FormulaR1C1 = "1"
   Range("A1").Select
Application.ScreenUpdating = True

End If
End Sub
NVM i figured it out myself.:laugh:
 
Upvote 0

Forum statistics

Threads
1,224,559
Messages
6,179,515
Members
452,921
Latest member
BBQKING

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