Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Inserting a space between characters in a cell | Excel Discussion (Misc queries) | |||
Extract numeric characters plus one character... | Excel Worksheet Functions | |||
Inserting a hyphen after the 3rd character | Excel Worksheet Functions | |||
Counting # of characters before a certain character | Excel Discussion (Misc queries) | |||
inserting special character in a cell as a macro | New Users to Excel |