PDA

View Full Version : macro don't work normally



mostafa90
01-06-2012, 10:26 AM
hi

this may sound silly, but i am 10 days new to programming. i have a written a code that picks contents of cells , under some conditions, and concatenate in another workbook.sheet.cell

the process works fine, next day nothing is working dunno why, i made a break point and watch variables it works fine and give me the result i want.

i am near to through my self out of the window...

any suggestions

for easy reference type in the inputbox : 9-1 or 1-5


------------------------------------------------------
Sub IRnumbers()

Static result As String
Dim rn As Long
Dim code As String
code = InputBox("Please enter the code number")
If code <> "" Then
Workbooks("transmittal log.xls").Worksheets(5).Activate


For rn = 1 To 10000
Select Case Range("q" & rn)
Case "ML"
Select Case Range("r" & rn)
Case code
Select Case Range("h" & rn)
Case "A", "B": result = result & Range("c" & rn) & "Rev." & Range("f" & rn) & ", "

End Select
Case "": Exit For
End Select

End Select

Next rn
End If
doit (result)
End Sub
-------------------------------------------------------------------------
Sub doit(txt As String)

Workbooks("Pay 13 Summary .xls").Worksheets(4).Activate
Range("i19").ClearContents

Range("i19") = txt
Range("i19").WrapText = True

End Sub

mostafa90
01-06-2012, 10:32 AM
i have attached the files via these 2 links

https://docs.google.com/open?id=0B9s5o9eJcr5NMTZmOTVhYjItNGUxNi00OWQxLThhYjctZWJlY2EzYzYwOTU5
https://docs.google.com/open?id=0B9s5o9eJcr5NNjI1ZTA5OWYtOWQwNi00NGQ1LThiZDAtN2M5Yzk1NWE5ODI0