Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Apologies in advance for this stupid question. I am attempting to write a
short macro for a co-worker that allows a user to select a range of spreadsheet data then save the selected data to a text file. How do you select the data then start the macro and reference the selected data within the macro? Everything I've tried chokes during debug. The operation seems trivial but apparently to this old boy , isn't. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub MyMacro()
Dim rng as Range On Error Resume Next set rng = application.InputBox("With the mouse, " & _ "Select the range to convert to text file",type:=8) On Error goto 0 if rng is nothing then msgbox "You hit cancel, bye!" exit sub End if rng.Select msgbox rng.Address End Sub -- Regards, Tom Ogilvy "Glenn" wrote in message ... Apologies in advance for this stupid question. I am attempting to write a short macro for a co-worker that allows a user to select a range of spreadsheet data then save the selected data to a text file. How do you select the data then start the macro and reference the selected data within the macro? Everything I've tried chokes during debug. The operation seems trivial but apparently to this old boy , isn't. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Tom, this is great for selecting the range but now what are the commands to
convert that range to text? Thanks, Mark Dyches "Tom Ogilvy" wrote: Sub MyMacro() Dim rng as Range On Error Resume Next set rng = application.InputBox("With the mouse, " & _ "Select the range to convert to text file",type:=8) On Error goto 0 if rng is nothing then msgbox "You hit cancel, bye!" exit sub End if rng.Select msgbox rng.Address End Sub -- Regards, Tom Ogilvy "Glenn" wrote in message ... Apologies in advance for this stupid question. I am attempting to write a short macro for a co-worker that allows a user to select a range of spreadsheet data then save the selected data to a text file. How do you select the data then start the macro and reference the selected data within the macro? Everything I've tried chokes during debug. The operation seems trivial but apparently to this old boy , isn't. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here's a couple of links that'll get you further along.
Earl Kiosterud's Text Write program: www.smokeylake.com/excel (or directly: http://www.smokeylake.com/excel/text_write_program.htm) Chip Pearson's: http://www.cpearson.com/excel/imptext.htm J.E. McGimpsey's: http://www.mcgimpsey.com/excel/textfiles.html Mark Dyches wrote: Tom, this is great for selecting the range but now what are the commands to convert that range to text? Thanks, Mark Dyches "Tom Ogilvy" wrote: Sub MyMacro() Dim rng as Range On Error Resume Next set rng = application.InputBox("With the mouse, " & _ "Select the range to convert to text file",type:=8) On Error goto 0 if rng is nothing then msgbox "You hit cancel, bye!" exit sub End if rng.Select msgbox rng.Address End Sub -- Regards, Tom Ogilvy "Glenn" wrote in message ... Apologies in advance for this stupid question. I am attempting to write a short macro for a co-worker that allows a user to select a range of spreadsheet data then save the selected data to a text file. How do you select the data then start the macro and reference the selected data within the macro? Everything I've tried chokes during debug. The operation seems trivial but apparently to this old boy , isn't. -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Glen;
Try this Sub try() Cells.Copy Workbooks.Add ActiveSheet.Paste Application.CutCopyMode = False Application.DisplayAlerts = False ActiveWorkbook.SaveAs Filename:= _ "C:\Documents and Settings\Administrator\My Documents\MyTextFile.csv", _ FileFormat:=xlCSV, CreateBackup:=False Range("A1").Select End Sub -----Original Message----- Apologies in advance for this stupid question. I am attempting to write a short macro for a co-worker that allows a user to select a range of spreadsheet data then save the selected data to a text file. How do you select the data then start the macro and reference the selected data within the macro? Everything I've tried chokes during debug. The operation seems trivial but apparently to this old boy , isn't. . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
getting a simple macro to begin execution on the selected cell | Excel Discussion (Misc queries) | |||
referencing selected cells | Excel Worksheet Functions | |||
How do I get macro to unmerge cells that have been previously merg | New Users to Excel | |||
Selection the previously selected cell | Excel Programming | |||
referencing values in adjacent cells to selected cell | Excel Programming |