View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Sinner Sinner is offline
external usenet poster
 
Posts: 142
Default Using xl MID function through VB.

Hi Steve,

J1 also changed : ). The values start 2nd row in column C i.e. C2 so
it should start from J2. First one is header.

Thx.


On Feb 21, 5:49*pm, Incidental wrote:
Hi Sinner

The code below would be one way to do it, though it will all depend on
if your numbers in column C being the same length. *Also i added an
apostrophe to the start of the value in column J to stop it from
changing to show "1" and dropping the leading 00. *This can be removed
from the code by deleting "'" & from the code.

Paste this code into the module for the sheet you want the code to
run.

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Column = 3 Then

* * Cells(Target.Row, 10).Value = "'" & Mid(Target.Value, 7, 3)

End If

End Sub

Hope this helps

Steve