ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel / Formatting a Cell / Setting a string range (https://www.excelbanter.com/excel-programming/375803-excel-formatting-cell-setting-string-range.html)

[email protected]

Excel / Formatting a Cell / Setting a string range
 
Hello,

Is there anyway to format a cell such that it can have the inputs of
'Y' or 'N'?

At the moment when I tie in a the output from a drop-down menu to a
particular cell, it seems to be converting the 'Y' and 'N' to a '1' and
'2'. It like to keep it at 'Y' and 'N'.

I am assuming that because it would be taking binary inputs, you could
actually act to convert the '1' and '2' to the corresponding 'Y' or 'N,
by writing a simple macro. But I figure there should be a simpler way...


Nigel

Excel / Formatting a Cell / Setting a string range
 
Have you looked at using Data-Validation?

For example in VBA to set a validation for range A1:A20

Sub ValRange()
With Range("A1:A20").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=
_
xlBetween, Formula1:="Y,N"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End Sub

--
Cheers
Nigel



wrote in message
oups.com...
Hello,

Is there anyway to format a cell such that it can have the inputs of
'Y' or 'N'?

At the moment when I tie in a the output from a drop-down menu to a
particular cell, it seems to be converting the 'Y' and 'N' to a '1' and
'2'. It like to keep it at 'Y' and 'N'.

I am assuming that because it would be taking binary inputs, you could
actually act to convert the '1' and '2' to the corresponding 'Y' or 'N,
by writing a simple macro. But I figure there should be a simpler way...





All times are GMT +1. The time now is 06:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com