when Cell A1 is blank

khalil

Board Regular
Joined
Jun 2, 2011
Messages
100
hi all
please help

when cell A1 is Blank i want the same cell A1= certain text

thanks in advance
:)
 
when i save it doesn't save

i am not yet familiar with these kind of codes

when i save it it gives me a message about about macro enabled excl workbook
 
Upvote 0

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
good morning

i tried to use the same code in another sheet in same workbook, i took in concede ration changing the target cell , but it did not work,

thanks
:)
 
Upvote 0
thanks , here you are;



Private Sub Worksheet_Change(ByVal target As Range)
If target.Address(False, False) = "BW5" Then
If target.Value = "" Then
Application.EnableEvents = False
target.Value = "?"
Application.EnableEvents = True
End If
End If
End Sub
 
Upvote 0
That works for me. Make sure the file is saved as .xlsm and that macros are enabled.
 
Upvote 0
it works with me when the code is alone in that sheet, but if there is another code like the one below in the same sheet, it doesn't work, and that code(you gave me):) is in another sheet also, (debug message appears).



Private Sub Worksheet_Change(ByVal target As Range)
If Not Intersect(target, Range("B:B")) Is Nothing Then
target.Offset(0, 1).Value = Date
End If
End Sub
 
Upvote 0
You need to combine them

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("B:B")) Is Nothing Then
    Application.EnableEvents = False
    Target.Offset(0, 1).Value = Date
    Application.EnableEvents = True
End If
If Target.Address(False, False) = "BW5" Then
    If Target.Value = "" Then
        Application.EnableEvents = False
        Target.Value = "?"
        Application.EnableEvents = True
    End If
End If
End Sub
 
Upvote 0
Thanks a lot

it works

if i need to add another target in the same sheet for the same code,i just have to combine them, please send me a tip for combining cods,


thanks in advance
:)
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,261
Members
452,901
Latest member
LisaGo

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