Welcome to the Excel Forum

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.

Please Register to Remove these Ads

Please Register to Remove these Ads



Reply
  #1  
Old 06-30-2009, 05:45 PM
mehdoush mehdoush is offline
Registered User
 
Join Date: 20 Feb 2009
Location: La, CA
MS Office Version:Excel 2003
Posts: 70
mehdoush is becoming part of the community
Runtime error 9 opening and editing macro

Please Register to Remove these Ads

hey guys,

i'm using a macro that opens and edit a report text file, when it gets to the part where it must decompose cells it displays "runtime error 9".

plz help
here are below two attached files (macro/report file)

regards
Attached Files
File Type: txt text testfile.txt (43.6 KB, 1 views)
File Type: xls macro testfile.xls (147.0 KB, 1 views)

Last edited by mehdoush; 06-30-2009 at 05:46 PM. Reason: decompose, runtime error 9, cells
Reply With Quote
  #2  
Old 06-30-2009, 06:13 PM
mehdoush mehdoush is offline
Registered User
 
Join Date: 20 Feb 2009
Location: La, CA
MS Office Version:Excel 2003
Posts: 70
mehdoush is becoming part of the community
Re: Runtime error 9 opening and editing macro

here's the decompose code

Code:
Sub decompose()
'decompose
Dim Rnng As Range, Dn As Range, oVal, oSp As Long
Dim Ray, cc As Long
Set Rnng = Range(Range("B3"), Range("B" & Rows.Count).End(xlUp))
ReDim Ray(1 To Rnng.Count * 4, 1 To 4)
For Each Dn In Rnng
    oVal = Split(Dn.Offset(, 3), "/")
     If UBound(oVal) > 0 Then
        For oSp = 0 To UBound(oVal)
            cc = cc + 1
            Ray(cc, 1) = Dn
            Ray(cc, 2) = Dn.Offset(, 1)
            Ray(cc, 3) = Dn.Offset(, 2)
            Ray(cc, 4) = oVal(oSp)
        Next oSp
    Else
        cc = cc + 1
        Ray(cc, 1) = Dn
        Ray(cc, 2) = Dn.Offset(, 1)
        Ray(cc, 3) = Dn.Offset(, 2)
        Ray(cc, 4) = Dn.Offset(, 3)
    End If
Next Dn

Range("B3").Resize(cc, 4).Value = Ray

'supprimer les lignes blank
'For i = Cells(Rows.Count, "D").End(xlUp).Row To 1 Step -1
'If IsEmpty(Cells(i, "D")) Then Rows(i).EntireRow.Delete
'Next i

End Sub
help plz
Reply With Quote
  #3  
Old 07-01-2009, 02:10 PM
mehdoush mehdoush is offline
Registered User
 
Join Date: 20 Feb 2009
Location: La, CA
MS Office Version:Excel 2003
Posts: 70
mehdoush is becoming part of the community
Re: Runtime error 9 opening and editing macro

any help plz ???
Reply With Quote


Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump