Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Export to CSV values

Hi
Having trouble with code to do the following.
Worksheet has data in columns A to F and rows 1 to 42.
I wish to export to CSV file all the rows except rows with the numeric value
0 in column F

I have done some VBA programing but not for a while so having trouble
getting started.

Any help would be greatfully accepted
Thanks
Neil


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Export to CSV values

I would record a macro when I applied Data|filter|autofilter (add headers if you
have to).

Show the 0's in column A.
Select those visible rows
F5 (or ctrl-g or edit|goto)|special|visible cells only

And paste into a new worksheet in a new workbook.

Then save that new workbook as a .csv file

Close (without saving) that new workbook.

"msnews.microsoft.com" wrote:

Hi
Having trouble with code to do the following.
Worksheet has data in columns A to F and rows 1 to 42.
I wish to export to CSV file all the rows except rows with the numeric value
0 in column F

I have done some VBA programing but not for a while so having trouble
getting started.

Any help would be greatfully accepted
Thanks
Neil


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Export to CSV values

Thanks Dave
Really looking for code to run from the click method on a button object.
The user (My wife) needs a 1 click solution as she has to do several of
these every week.
Cheers
Neil
"Dave Peterson" wrote in message
...
I would record a macro when I applied Data|filter|autofilter (add headers
if you
have to).

Show the 0's in column A.
Select those visible rows
F5 (or ctrl-g or edit|goto)|special|visible cells only

And paste into a new worksheet in a new workbook.

Then save that new workbook as a .csv file

Close (without saving) that new workbook.

"msnews.microsoft.com" wrote:

Hi
Having trouble with code to do the following.
Worksheet has data in columns A to F and rows 1 to 42.
I wish to export to CSV file all the rows except rows with the numeric
value
0 in column F

I have done some VBA programing but not for a while so having trouble
getting started.

Any help would be greatfully accepted
Thanks
Neil


--

Dave Peterson



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Export to CSV values

I bet your recorded macro would be pretty close to perfect.

"msnews.microsoft.com" wrote:

Thanks Dave
Really looking for code to run from the click method on a button object.
The user (My wife) needs a 1 click solution as she has to do several of
these every week.
Cheers
Neil
"Dave Peterson" wrote in message
...
I would record a macro when I applied Data|filter|autofilter (add headers
if you
have to).

Show the 0's in column A.
Select those visible rows
F5 (or ctrl-g or edit|goto)|special|visible cells only

And paste into a new worksheet in a new workbook.

Then save that new workbook as a .csv file

Close (without saving) that new workbook.

"msnews.microsoft.com" wrote:

Hi
Having trouble with code to do the following.
Worksheet has data in columns A to F and rows 1 to 42.
I wish to export to CSV file all the rows except rows with the numeric
value
0 in column F

I have done some VBA programing but not for a while so having trouble
getting started.

Any help would be greatfully accepted
Thanks
Neil


--

Dave Peterson


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Export to CSV values

Thanks for your help Dave
You seem to give a lot of help to others.
Your idea was a good one however I got off my butt and wrote the following
code.

Private Sub CommandButton2_Click()
Dim Check, Counter, Myfile
Myfile = Cells(1, 8) ' name of file to export
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile(Myfile, True)
Check = True: Counter = 0 ' Initialize variables.

Do ' Outer loop.
Do While Counter < 43 ' Inner loop.
Counter = Counter + 1 ' Increment Counter.
If Counter <= 42 Then 'If condition is True.

If Cells(Counter, 6) 0 Then
a.WriteLine (Cells(Counter, 7))
'=CONCATENATE(TEXT(A1,"dd/mm/yy"),",",B1,",",C1,",",D1,",",E1,",",F1)
End If

Else

Check = False ' Set value of flag to False.
a.Close ' flush the buffer and close the file.
End If
Exit Do
Loop
Loop Until Check = False ' Exit outer loop immediately.

End Sub

Thanks again
Neil
"Dave Peterson" wrote in message
...
I bet your recorded macro would be pretty close to perfect.

"msnews.microsoft.com" wrote:

Thanks Dave
Really looking for code to run from the click method on a button object.
The user (My wife) needs a 1 click solution as she has to do several of
these every week.
Cheers
Neil
"Dave Peterson" wrote in message
...
I would record a macro when I applied Data|filter|autofilter (add
headers
if you
have to).

Show the 0's in column A.
Select those visible rows
F5 (or ctrl-g or edit|goto)|special|visible cells only

And paste into a new worksheet in a new workbook.

Then save that new workbook as a .csv file

Close (without saving) that new workbook.

"msnews.microsoft.com" wrote:

Hi
Having trouble with code to do the following.
Worksheet has data in columns A to F and rows 1 to 42.
I wish to export to CSV file all the rows except rows with the numeric
value
0 in column F

I have done some VBA programing but not for a while so having trouble
getting started.

Any help would be greatfully accepted
Thanks
Neil

--

Dave Peterson


--

Dave Peterson



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
Export Conditional Formatting Values dcohen Excel Worksheet Functions 0 October 19th 06 01:50 PM
CSV export from Excel always recognise null values in the last col RichardOKeefe Excel Discussion (Misc queries) 2 April 28th 06 06:56 AM
Save as or export with values only Zubair Excel Worksheet Functions 3 January 16th 05 03:18 PM
Export values in a text file Matrix[_2_] Excel Programming 7 November 2nd 03 04:29 PM


All times are GMT +1. The time now is 01:56 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"