Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Export Conditional Formatting Values | Excel Worksheet Functions | |||
CSV export from Excel always recognise null values in the last col | Excel Discussion (Misc queries) | |||
Save as or export with values only | Excel Worksheet Functions | |||
Export values in a text file | Excel Programming |