Looking at a cell A1 and changing value in B1 with macro!

eddy

Well-known Member
Joined
Mar 2, 2002
Messages
521
Sounds easy but this is I would like.
Cell A1 could contain nothing, a,b,c, or d (alpha characters)
I would like the following to be true:-
If cell A1 = nothing then cell B1 = a
If cell A1 = a then cell B1 = b
If cell A1 = b then cell B1 = c
If cell A1 = c then cell B1 = d
If cell A1 = d then cell B1 = e
Thanks ed

_________________
From eD
traspberries@hotmail.com
This message was edited by eddy on 2002-03-05 14:08
This message was edited by eddy on 2002-03-05 14:09
This message was edited by eddy on 2002-03-05 14:16
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
See if this works for you. Right click on your sheet tab, left click on View Code, and paste this in:

''''''''''''''''''''''''''''''''''''

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address <> "$A$1" Or Target.Cells.Count > 1 Then Exit Sub

Select Case [A1].Value

Case ""
[B1] = "a"
Case "a"
[B1] = "b"
Case "b"
[B1] = "c"
Case "c"
[B1] = "d"
Case "d"
[B1] = "e"
Case Else
Exit Sub

End Select

End Sub

'''''''''''''''''''''''''''''''''''

Tom Urtis
 
Upvote 0
Dim intCell, test
With ActiveSheet
intCell = 1
Do Until intCell = 7
If .Cells(intCell, 1) = "" Then
.Cells(intCell, 2) = "a"
Else
.Cells(intCell, 2) = Chr(Asc(.Cells(intCell, 1)) + 1)
End If
intCell = intCell + 1
Loop
End With
End Sub



Or a formula in B1:B6
=IF(A1="","a",CHAR(CODE(A1)+1))
 
Upvote 0
GREAT !!!
Thanks everyone they all worked fine. In the end I was able to use the very simple formula =IF(A1=" ","a",CHAR(CODE(A1)+1)). It works a treat.
To you all many,many thanks for your trouble!
Rgds eD
 
Upvote 0

Forum statistics

Threads
1,223,396
Messages
6,171,864
Members
452,427
Latest member
samk379

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