Can someone PLEASE take a look at this code and tell me what I am doing wrong???? Here is the history, I can select to desired Range... NO PROBLEM.... I can even create the File I want to save the data in selected Range.... BUT... I can not get my data to paste into that newly created file. Can someone please help.
Sub Selected_Range()
Dim wsSheet As Worksheet
Dim rnArea As Range
Sheets("Sheet2").Select
Set wsSheet = ThisWorkbook.Worksheets("Sheet2")
With wsSheet
Set rnArea = .Range(.Range("D3"), Range("D" & .Range("D65536").End(xlUp).Row))
End With
rnArea.Select
Selection.Copy
ColFileName = "A:\ShaIn.txt"
Workbooks.Add
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
ActiveWorkbook.SaveAs Filename:=ColFileName, FileFormat:=xlText, CreateBackup:=False
ActiveWorkbook.Close
End Sub
I have even tried
'Open "C:\Documents and SettingsmayfieldDesktopSha1 Text FilesSha_In.txt" For Output As #1
and gone that route... but again, the data will not copy. And I have searched this board for help that I could understand... but none of it seems to be what I am looking for. Maybe I have overlooked something.
HELP!!!?????!!!!
This message was edited by K_Man95 on 2002-08-29 17:30
Sub Selected_Range()
Dim wsSheet As Worksheet
Dim rnArea As Range
Sheets("Sheet2").Select
Set wsSheet = ThisWorkbook.Worksheets("Sheet2")
With wsSheet
Set rnArea = .Range(.Range("D3"), Range("D" & .Range("D65536").End(xlUp).Row))
End With
rnArea.Select
Selection.Copy
ColFileName = "A:\ShaIn.txt"
Workbooks.Add
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
ActiveWorkbook.SaveAs Filename:=ColFileName, FileFormat:=xlText, CreateBackup:=False
ActiveWorkbook.Close
End Sub
I have even tried
'Open "C:\Documents and SettingsmayfieldDesktopSha1 Text FilesSha_In.txt" For Output As #1
and gone that route... but again, the data will not copy. And I have searched this board for help that I could understand... but none of it seems to be what I am looking for. Maybe I have overlooked something.
HELP!!!?????!!!!
This message was edited by K_Man95 on 2002-08-29 17:30