Hi,
I am working on a vba macro which copies four cell's value in a row(left side of fifth column) to a notepad if the value in fifth cell's value in that row is numeric. It copies first row successfully but for the second row, third row...and so on it throws "DISK FULL ERROR".
For your better understanding i am pasting the piece of code i am working with and i've attached the same as well,
Sub test()
Dim r As Integer
Dim i As Integer
Dim destnum As Integer
Dim str As String
r = 0
i = 0
Range("a1").Select
Do Until IsEmpty(Selection.Value)
Selection.Offset(1, 0).Select
r = r + 1
Loop
Range("e1").Select
For i = 1 To r Step 1
If Selection.Value = " " Or Not IsNumeric(Selection.Value) Then
Selection.Offset(1, 0).Select
Else
If i = 1 Then
ActiveCell.Offset(0, -1).Select
Range(ActiveCell, ActiveCell.Offset(0, -3)).Copy
Shell "notepad.exe", vbNormalFocus
SendKeys "^v"
SendKeys "^s"
SendKeys "beta.txt"
SendKeys "{enter}"
SendKeys "%{F4}"
ActiveCell.Offset(1, 1).Select
Else
ActiveCell.Offset(0, -1).Select
str = Range(ActiveCell, ActiveCell.Offset(0, -3)).Copy
destnum = FreeFile()
Open "beta.txt" For Append As destnum
Print destnum, str
SendKeys "^s"
Close destnum
ActiveCell.Offset(1, 1).Select
End If
End If
Next
End Sub
Any help will be greatly appreciated.
Thanx in advance.
Himanshu
Bookmarks