LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Executing macro on cell change.

Hi,

I have the following code which I would like to execute each after a change
is made to any cell in column A. Only trouble is if I place it in a
"Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)" sub, it
gets locked in an endless loop. Does anyone have any suggestions?

___

Sub Code()
Application.ScreenUpdating = False
Cells(1, 1).Select
Do While Not IsEmpty(ActiveCell)
CellNum = ActiveCell.Value
CellLength = Len(CellNum)
CellVal = Empty
If IsNumeric(CellNum) Then
CellNum = CellNum * 100
Else
Application.ScreenUpdating = True
Err = MsgBox(" Non numeric value in cell?", vbOKCancel)
If Err = vbCancel Then End
End If
Application.ScreenUpdating = False
For i = 1 To CellLength
If Mid(CellNum, i, 1) = 1 Then CellVal = CellVal & "A"
If Mid(CellNum, i, 1) = 2 Then CellVal = CellVal & "B"
If Mid(CellNum, i, 1) = 3 Then CellVal = CellVal & "C"
If Mid(CellNum, i, 1) = 4 Then CellVal = CellVal & "D"
If Mid(CellNum, i, 1) = 5 Then CellVal = CellVal & "E"
If Mid(CellNum, i, 1) = 6 Then CellVal = CellVal & "F"
If Mid(CellNum, i, 1) = 7 Then CellVal = CellVal & "G"
If Mid(CellNum, i, 1) = 8 Then CellVal = CellVal & "H"
If Mid(CellNum, i, 1) = 9 Then CellVal = CellVal & "I"
If Mid(CellNum, i, 1) = 0 Then CellVal = CellVal & "Z"
Next

ActiveCell.Offset(0, 1).Value = CellVal
ActiveCell.Offset(1, 0).Select
Loop
Application.ScreenUpdating = True
End Sub



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
executing a macro within another brian Excel Discussion (Misc queries) 3 July 5th 06 01:22 AM
Executing a macro from a cell filo666 Excel Discussion (Misc queries) 2 February 15th 05 08:18 PM
finding the first blank cell and then executing rest of macro Ed[_25_] Excel Programming 1 December 13th 04 07:24 PM
What macro is executing? Ken Loomis Excel Programming 3 October 13th 04 05:39 AM
executing a macro from within a cell kduntley Excel Programming 2 May 13th 04 05:38 PM


All times are GMT +1. The time now is 04:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"