Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default inserting a character amongst characters in a cell.

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default inserting a character amongst characters in a cell.

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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default inserting a character amongst characters in a cell.

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






  #4   Report Post  
Posted to microsoft.public.excel.programming
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








Reply
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
Inserting a space between characters in a cell mrmnz Excel Discussion (Misc queries) 5 April 2nd 23 01:55 PM
Extract numeric characters plus one character... KLZA Excel Worksheet Functions 14 February 4th 09 03:23 AM
Inserting a hyphen after the 3rd character [email protected] Excel Worksheet Functions 3 October 29th 08 07:48 PM
Counting # of characters before a certain character NickPro72 Excel Discussion (Misc queries) 4 August 22nd 08 09:17 PM
inserting special character in a cell as a macro johnnyboy New Users to Excel 3 September 11th 06 09:05 PM


All times are GMT +1. The time now is 01:33 PM.

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"