Home |
Search |
Today's Posts |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks so much Sheeloo!!!
Regards, Ryan--- -- RyGuy "Sheeloo" wrote: Try this (I tested and it worked) As I had said earlier 'c' was not defined or set to anything... Also you were not selecting the Cells(i,1) so ActiveCell was not set to Cell(i,1) Do take care of continuation character "_" Sub TtoC() 'Dim c As Variant Dim LastRow As Long Dim i As Long ActiveSheet.UsedRange.Rows.Hidden = False LastRow = Cells(Rows.Count, 1).End(xlUp).Row For i = LastRow To 2 Step -1 If InStr(1, Cells(i, 1), "Relative dose", vbTextCompare) Then Cells(i, 1).Select 'ActiveCell.Select Selection.TextToColumns Destination:=Cells(i, 1), DataType:=xlDelimited _ , TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=True, _ Semicolon:=False, Comma:=False, Space:=True, Other:=False, FieldInfo _ :=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1)), _ TrailingMinusNumbers:=True End If Next End Sub "ryguy7272" wrote: I made a slight modification, but it still is not working. I am now using this code: Sub TtoC() 'Dim c As Variant Dim LastRow As Long Dim i As Long ActiveSheet.UsedRange.Rows.Hidden = False LastRow = Cells(Rows.Count, 1).End(xlUp).Row For i = LastRow To 2 Step -1 If InStr(1, Cells(i, 1), "Relative dose", vbTextCompare) Then ActiveCell.Select Selection.TextToColumns Destination:=Range(c), DataType:=xlDelimited _ , TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=True, _ Semicolon:=False, Comma:=False, Space:=True, Other:=False, FieldInfo _ :=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1)), TrailingMinusNumbers:=True End If Next End Sub It fails on this line: Selection.TextToColumns Destination:=Range(c), DataType:=xlDelimited _ Any suggestions or do I need to reconsider the method of my approach? Thanks, Ryan--- -- RyGuy RyGuy |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
Question on determining "ROW" inside of a "For .. RANGE " loop | Excel Programming | |||
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next | New Users to Excel | |||
LOOP BETWEEN "FRONT" AND "END" SHEETS? | Excel Programming | |||
Change "relative" to "absolute" (database) | Excel Programming |