Default value in cell

Bill Morris

New Member
Joined
Aug 1, 2011
Messages
38
Hi

I have a spreadsheet whereby I want a formula ir VBA code to apply depending upon if another cell contains anything.

For example

A1 contain text. In B1 the user can add text, but if it is left blank then I want a dash ("-") as the default value.

If A2 doesn't contain anything then I want B2 to be left blank.

Thanks
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
could be as simple as

Code:
Set myRange = sheets("Data").Range("A1:" & Cells(Rows.Count, "A").End(xlUp).Address)

Me again.

If I want this range to start from cell C38 rather than A1 and for the default "-" to appear in N38 onwards....what changes do I need to make?
 
Upvote 0

Forum statistics

Threads
1,216,084
Messages
6,128,722
Members
449,465
Latest member
TAKLAM

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