PDA

View Full Version : Hi guys can you correct my code here?



lncrj017
03-19-2012, 02:31 AM
help guys, Whats the actual code for this vba code sample... someone you modify it? thanks


If Not Cells(rws, 61).Value Is Nothing Then .Cells(rws, 61).Value = Application.WorksheetFunction.Replace(arg1:="|", arg2:=1, arg3:=4, arg4:=", ")
If Not Cells(rws, 63).Value Is Nothing Then .Cells(rws, 63).Value = Application.WorksheetFunction.Replace(arg1:="|", arg2:=1, arg3:=4, arg4:=", ")
If Not Cells(rws, 64).Value Is Nothing Then .Cells(rws, 64).Value = Application.WorksheetFunction.Replace(arg1:="|", arg2:=1, arg3:=4, arg4:=", ")
If Not Cells(rws, 65).Value Is Nothing Then .Cells(rws, 65).Value = Application.WorksheetFunction.Replace(arg1:="|", arg2:=1, arg3:=4, arg4:=", ")
If Not Cells(rws, 66).Value Is Nothing Then .Cells(rws, 66).Value = Application.WorksheetFunction.Replace(arg1:="|", arg2:=1, arg3:=4, arg4:=", ")

lncrj017
03-19-2012, 02:32 AM
By the Way Im using With statement above

Bob Phillips
03-19-2012, 03:37 AM
Not a very good description of what you need, but my guess is



With ActiveSheet

For i = 61 To 66

With .Cells(rws, i)

If .Value <> "" Then .Value = Replace(Left$(.Value, 4), "|", ", ") & Right$(.Value, Len(.Value) - 4)
End With
Next i
End With

lncrj017
03-19-2012, 05:57 PM
sorry for confusing you sir... here's my example file i hope you can solve my problem hehehe cheers :rotlaugh:

Bob Phillips
03-20-2012, 01:58 AM
You still don't say what the problem is!