View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
J.E. McGimpsey J.E. McGimpsey is offline
external usenet poster
 
Posts: 493
Default VB PasteSpecial when range changes

Did you try recording a macro - select column A, copy, paste special
to B, delete A, save as .txt?

This is what I get:

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 12/27/2003 by J.E. McGimpsey
'

'
Columns("A:A").Select
Selection.Copy
Columns("B:B").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Columns("A:A").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
ChDir "<my path"
Columns("A:A").Select
ActiveWorkbook.SaveAs Filename:= _
"<my pathList.txt", FileFormat:=xlText, _
CreateBackup:=False
End Sub

It doesn't take a lot of work to clean it up:

Public Sub Macro1()
Columns("A:A").Copy
Columns("B:B").PasteSpecial Paste:=xlValues
Columns("A:A").Delete Shift:=xltoLeft
ActiveWorkbook.SaveAs _
Filename:="<my pathList.txt", _
FileFormat:=xlText
End Sub

In article ,
mjwillyone wrote:

Dear Friends,

I have a list of names in column A that changes each time I run a
concatenate macro I have created. The number of different names is
never the same.

I would like a way to copy the complete list of names and paste-special
then to column B. I want to paste-special I do not want the
concatenate formula to copy, only the values. Then I need to delete
column A. Next, I need a way to export to a simple text file (called
Name List.txt) the entire list of names.

Thank you in advance for your help.


---
Message posted from http://www.ExcelForum.com/