If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Display Modes |
#11
|
|||
|
|||
i want to create a formula to change a months name
Unless there is some special requirement for this unusual system of calling
up the Month names, you might consider a simple Data Validation Drop Down box and just select the desired month from the drop-down list.............. Vaya con Dios, Chuck, CABGx3 "change a month" wrote in message ... I want to create a formula to allow me to enter a # into a cell that will display a corresponding months name in that cell. In doing an IF statement I have been getting a cricular error, I assume because i'm creating the formula IN the refrence cell, or Excel can't find the project or library. Either way I'm sure I'm not creating the formula correctly. Example: I want to enter 01 for January, 02 for February and have the corresponding mont displayed in the cell I'm creating the formula in. Is this possibe if written in the same cell? Sounds pretty simple but I can't get an "IF" statement to work for me. It's been a loooong time since I last worked with Excel so I'd appreciate any help you can give. BTW: my office is 2002 Pro. |
#12
|
|||
|
|||
i want to create a formula to change a months name
Difference in style perhaps, though I certainly should have cycled
..EnableEvents. For a non-looping Worksheet_Change() macro, speed is almost always irrelevant - the code will be finished before the enter key has returned to full up. As for errors, I didn't assume that the user might not want to enter 13 or 27. It's more likely that the number should be limited to 1-12, though. If that is the case, I'd be more inclined to return an error value if a non-numeric entry or a numeric entry outside the bounds [1-12] were entered, rather than exiting the sub: Private Sub Worksheet_Change(ByVal rCell As Range) Dim bValid As Boolean With rCell If .Address(False, False) = "A1" Then Application.EnableEvents = False If IsNumeric(.Value) Then If .Value = 1 And .Value = 12 Then .Value = Format(DateSerial(2004, _ .Value, 1), "mmmm") bValid = True End If End If If Not bValid Then .Value = CVErr(xlErrValue) Application.EnableEvents = True End If End With End Sub In article , "David McRitchie" wrote: This should allow you to type in a number 1 - 12, anything else will show up as entered. Use of dateserial, I think would be slower and the example had no provision for errors. |
|
Thread Tools | |
Display Modes | |
|
|