Change value of a certain cell and will display or not a certain text in a range of cells

beapotz10

New Member
Joined
Jul 3, 2019
Messages
4
I really have never used vba before but i am really eager to nail this one.

What I want to happen is if I input "X" to cell E7, it will show the word same in a range of cells (ex: H1:H50) and if I delete the "X" on E7, the text will also be removed.

Please please help :help::help::help:
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Right click on the sheet tab. Press view code. In the 'white space' paste this:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)

Dim rng As Range

Application.EnableEvents = False

Set rng = Intersect(Target, Range("E7"))

If Not rng Is Nothing Then
    If Len(rng.Value) > 0 Then
        Range("H1:H50") = rng.Value
    Else
        Range("H1:H50").ClearContents
    End If
End If

Application.EnableEvents = True

End Sub

See if that works for you.
 
Upvote 0
Well saving it isnt going to make any difference presuming of course you saved it with the code in place and the file is a macro enabled workbook with macros duly enabled. Check the code is still in the worksheet module.
 
Upvote 0

Forum statistics

Threads
1,223,248
Messages
6,171,011
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