assign text only if current cell is in range g100:g220

exceltadpole

Board Regular
Joined
Jan 14, 2004
Messages
108
I am updating an old sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
End Sub

How do assign the text "Received, Payment Due Immediately" to the current cell ONLY IF the current cell is in the range g100:g220 ?
The user has to scroll thru 200+ cells this would certainly speed up the data entry and avoid spelling mistakes.
 

Some videos you may like

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

exceltadpole

Board Regular
Joined
Jan 14, 2004
Messages
108
Here is the pseudo code for what I need

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

if the current cell is in the range g100:g220 then
current cell = "Received, Payment Due Immediately"
end if

End Sub
 

NateO

Legend
Joined
Feb 17, 2002
Messages
9,700
Hello, try the following:

<font face=Courier New><SPAN style="color:darkblue">Private</SPAN> <SPAN style="color:darkblue">Sub</SPAN> Worksheet_SelectionChange(<SPAN style="color:darkblue">ByVal</SPAN> Target <SPAN style="color:darkblue">As</SPAN> Range)
<SPAN style="color:darkblue">If</SPAN> <SPAN style="color:darkblue">Not</SPAN> Intersect(Target(1, 1), [g100:g220]) <SPAN style="color:darkblue">Is</SPAN> <SPAN style="color:darkblue">Nothing</SPAN> Then _
    Target(1, 1) = "Received, Payment Due Immediately"
<SPAN style="color:darkblue">End</SPAN> <SPAN style="color:darkblue">Sub</SPAN></FONT>

But, would it not be better to have a Change event that completed the entry based on a different entry?
 

Watch MrExcel Video

Forum statistics

Threads
1,122,560
Messages
5,596,842
Members
414,107
Latest member
Tigretto

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
Top