View Single Post
  #17   Report Post  
Posted to microsoft.public.excel.programming
ILoveMyCorgi ILoveMyCorgi is offline
external usenet poster
 
Posts: 55
Default How change cell to another character, add comma, & continue ne

PERFECT!! Thanks a million for helping me out with this... I really
appreciate it. Have a great weekend.
Susan

"Rick Rothstein" wrote:

Okay, try this code then (do not forget to change the worksheet names)...

Sub ProcessPerColumns()
Dim X As Long
Dim Z As Long
Dim LastRow As Long
Dim LastOutputRow As Long
Dim Output1 As String
Dim Output2 As String
Dim Output3 As String
Dim NumberDate As Range
With Worksheets("DataSheet")
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For X = 2 To LastRow
Set NumberDate = .Range("A" & LastRow & ":B" & LastRow)
Output1 = .Cells(X, "A").Value
Output2 = .Cells(X, "B").Value
Output3 = ""
For Z = 3 To 10 'Columns C thru J
If .Cells(X, Z).Value Like "[Tt]" Then
If Len(Output3) 0 Then Output3 = Output3 & ", "
Output3 = Output3 & (Z - 3)
End If
Next
With Worksheets("OutputSheet")
LastOutputRow = .Cells(.Rows.Count, "A").End(xlUp).Row
If LastOutputRow = 1 And .Range("A1").Value = "" Then
LastOutputRow = 0
End If
.Cells(LastOutputRow + 1, "A").Value = Output1
.Cells(LastOutputRow + 1, "B").Value = Output2
.Cells(LastOutputRow + 1, "C").Value = "'" & Output3
End With
Next
End With
End Sub

--
Rick (MVP - Excel)


"ILoveMyCorgi" wrote in message
...
Thanks! I changed the code renaming the worksheets and the code ran!
Unfortunately, instead of having the result in one cell, I wanted to have
the
output in three separate columns; i.e., cola 1234 colb 08/25/2008 COLC
1,2,3.
I also wanted the "1,3,5" if columns Per1, Per3, and Per5 had a T in it...
I
hope you can help me with this. Thanks, everyone!

"Rick Rothstein" wrote:

Ah, I see. Actually, the intent was for the you, and the OP, to change
the
example worksheet names I used in my code to whatever actual worksheet
name
you are using in your own workbook. In other words, where my code
had.this...

With Worksheets("DataSheet")

the you, and the OP, were supposed to change "DataSheet" to whatever name
your own worksheet has. So, for example, if your data was located on
"MyDataSheet3", then the above code line was to be changed to this...

With Worksheets("MyDataSheet3")

and similar change should be made where I used this...

With Worksheets("OutputSheet")

in my code also (using the actual name you gave to your output worksheet
in
place of my example worksheet name of "OutputSheet"). The key thing to
note
is the code was supposed to be changed to match your actual conditions,
*not* the other way around. If the OP had posted the worksheet names for
us
in the original posting, I would have used them in my code; since the OP
didn't, I simply made up example names instead.

--
Rick (MVP - Excel)


"dan dungan" wrote in message
...
Hi Rick

First of all, I take your posting to mean you did not get the error
message
that the OP got (in other words, my code ran "error" free on your
system).

I got the same error: 9 Subscript out of range until I used the same
worksheet names in your code. Now it runs error free.

Thanks for your time and input.

Dan