LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default splitting a cell into 2

Hi Frank,

thanks a bunch!


-----Original Message-----
Hi
try (watch for linewraps):

Sub split_rows()
Dim RowNdx As Long
Dim LastRow As Long
Dim left_val
Dim right_val

Application.ScreenUpdating = False
LastRow = ActiveSheet.Cells(Rows.Count, "H").End

(xlUp).Row
For RowNdx = LastRow To 1 Step -1
With Cells(RowNdx, "H")
If .Value < "" Then
left_val = CDbl(Trim(Left(.Value, InStr
(.Value, "-") - 1)))
right_val = CDbl(Trim(Mid(.Value, InStr
(.Value, "-") + 1, 15)))
.Offset(0, 1).Value = left_val
.Offset(0, 2).Value = right_val
End If
End With
Next RowNdx
Application.ScreenUpdating = True
End Sub


-----Original Message-----
Hi Frank,

VBA would be ideal so I can have one macro do it all in
one click.

-----Original Message-----
Hi
why not use a non-VBA solution: Use 'Data - Text to
columns'

Or is VBA required for you?

-----Original Message-----
Hello,

I can't figure this one out. Via a web query, I get

a
value for H2 of "1,926.09 - 1,954.62".

I'd like to, through VBA, split the value in H2 and
paste them into 2 cells, I2 and J2. The f'inal

result
would be I2 = "1,926.09" and J2 = "1,954.62".

Can anyone help me?

Thanks in advance
.

.

.

.



 
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
splitting my cell rodchar Excel Discussion (Misc queries) 5 July 22nd 08 03:24 PM
Splitting a cell jayfin New Users to Excel 6 December 19th 07 04:05 AM
Splitting a Cell williamr Excel Worksheet Functions 2 June 13th 07 01:30 AM
splitting a cell wnfisba Excel Discussion (Misc queries) 7 April 10th 07 10:22 AM
Splitting a Cell c Excel Worksheet Functions 5 April 11th 05 10:23 PM


All times are GMT +1. The time now is 06:51 AM.

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

About Us

"It's about Microsoft Excel"