Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default Writing to a file from excel

Hi,

need help with the following.
I have cell1 cell3 cell 4 selected then need to run a macro that will write
the values of the the selected cells to a file in the following format.


copy cell1.value + cell3.value + cell4 C:\docs\Bigfile.txt

I have all except that I dont know how to get it written the cell value
followed by a "+" then the next selected cell value...also I dont need the
last cell to be followed by a + sign

I will really appreciate any help..


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Writing to a file from excel

cell1.value & " + " & cell3.value & " + " & cell4.value

You may have to assign this to a variable before writing to the file.

HTH, Greg

"Cesar Zapata" wrote in message
...
Hi,

need help with the following.
I have cell1 cell3 cell 4 selected then need to run a macro that will

write
the values of the the selected cells to a file in the following format.


copy cell1.value + cell3.value + cell4 C:\docs\Bigfile.txt

I have all except that I dont know how to get it written the cell value
followed by a "+" then the next selected cell value...also I dont need the
last cell to be followed by a + sign

I will really appreciate any help..




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Writing to a file from excel

Sub Tester1()
sStr = ""
For Each cell In Selection
sStr = sStr & cell.Value & " + "
Next
sStr = Left(sStr, Len(sStr) - 3)

Open "C:\docs\Bigfile.txt" For Output As #1
Print #1, sStr
Close #1
End Sub

--
Regards,
Tom Ogilvy

"Cesar Zapata" wrote in message
...
Hi,

need help with the following.
I have cell1 cell3 cell 4 selected then need to run a macro that will

write
the values of the the selected cells to a file in the following format.


copy cell1.value + cell3.value + cell4 C:\docs\Bigfile.txt

I have all except that I dont know how to get it written the cell value
followed by a "+" then the next selected cell value...also I dont need the
last cell to be followed by a + sign

I will really appreciate any help..




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing to notepad file Jeff Excel Discussion (Misc queries) 2 October 23rd 06 03:16 AM
writing on an excel file RITZ New Users to Excel 3 September 2nd 06 09:44 PM
Writing a .txt file Claus[_2_] Excel Programming 2 September 27th 04 01:47 AM
Writing a text file from Excel using VBA ... a small issue ajames54 Excel Programming 3 December 3rd 03 03:35 PM
file writing Mike[_49_] Excel Programming 0 November 22nd 03 06:57 PM


All times are GMT +1. The time now is 02:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"