View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default inserting a character amongst characters in a cell.

Sub dec()
Dim j as long, k as long

j = 3
k = 2

Do Until isempty(cells(j,k))

Cells(j,k).Value = Left(Cells(j,k).Value, 3) _
& "." & Right(Cells(j,k).Value, 3)
j = j + 1
Loop
End Sub

thought I answered this, but don't see it. If this is a duplicate, then
ignore.

--
Regards,
Tom Ogilvy

philster wrote in message
...
Hi Tom

thanks for your reply, but I'm still having problems

I've done what you suggested but not getting anywhere I'm afraid.

Please assist me in coding this, I'm new to VB
----------
Sub dec()


j = 3
k = 2



Do Until j = ""

Cell.Value = Left(Cell.Value, 3) & "." & Right(Cell.Value, 3)

Loop



End Sub
----------

The data that needs to be changed is in column 2 and the data starts from
row 3 of the spreadsheet.


many thanks

Phil


"Tom Ogilvy" wrote in message
...
Cell.Value = Left(cell.Value,3) & "." & Mid(Cell.Value,4,255)

or if always 6 characters:

Cell.Value = Left(cell.Value,3) & "." & Right(Cell.Value,3)


--
Regards,
Tom Ogilvy


philster wrote in message
...
Hi everyone

I need some help with excel visual basic.

I need to insert a character in amongst characters in a cell (column).

for example, for currency pair 'AUDUSD', I want to be able to insert

to
a
period '.' in between the third and forth character so that it looks

like
'AUD.USD'

The content of the cell would not be AUDUSD all the time of course,

but
the
inserted '.' needs to be between the third and forth character

everytime.

Can someone tell me how to code this.

thanks

Phil