Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi,
I have a small spreadsheet with 20 check boxes in Column A (A1-A20). They are all linked to corresponding cells in Column B which give TRUE or FALSE depending on if they are checked or unchecked. No problem there. I have the corresponding check boxes displaying "Computer 1" in cell C1 and so on down to C20 i.e. Formula in C1 is =IF(B1,"Computer 1","") Once the user has checked/unchecked as required then I'd like to be able to save Column C1:C20 and Column D1:D20 to a csv file called "UserInput.csv" Thanks Ephraim |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I'd start a new workbook
Then back to the original worksheet Edit|Copy columns C:D Edit|Pastespecial|values into A1 of the new worksheet in the new workbook Save this file as the .csv file Close the new workbook. ======== Another option that may work for you: Put a formula like this in E1: =c1&","&d1 and drag down Then copy this column and paste into NotePad. Save that as a .CSV file. Depending what's in those fields, you may want to add double quotes, too. Ephraim wrote: Hi, I have a small spreadsheet with 20 check boxes in Column A (A1-A20). They are all linked to corresponding cells in Column B which give TRUE or FALSE depending on if they are checked or unchecked. No problem there. I have the corresponding check boxes displaying "Computer 1" in cell C1 and so on down to C20 i.e. Formula in C1 is =IF(B1,"Computer 1","") Once the user has checked/unchecked as required then I'd like to be able to save Column C1:C20 and Column D1:D20 to a csv file called "UserInput.csv" Thanks Ephraim -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
On Mar 30, 4:11*pm, Dave Peterson wrote:
I'd start a new workbook Then back to the original worksheet Edit|Copy columns C:D Edit|Pastespecial|values into A1 of the new worksheet in the new workbook Save this file as the .csv file Close the new workbook. ======== Another option that may work for you: Put a formula like this in E1: =c1&","&d1 and drag down Then copy this column and paste into NotePad. *Save that as a .CSV file.. Depending what's in those fields, you may want to add double quotes, too. Ephraim wrote: Hi, I have a small spreadsheet with 20 check boxes in Column A (A1-A20). They are all linked to corresponding cells in Column B which give TRUE or FALSE depending on if they are checked or unchecked. No problem there. I have the corresponding check boxes displaying "Computer 1" in cell C1 and so on down to C20 i.e. Formula in C1 is =IF(B1,"Computer 1","") Once the user has checked/unchecked as required then I'd like to be able to save Column C1:C20 and Column D1:D20 to a csv file called "UserInput.csv" Thanks Ephraim -- Dave Peterson- Hide quoted text - - Show quoted text - I'm trying to make this as transparent to the user as possible. The resulting file will be providing input to a powershell 2.0 script. Leaving it to the user leaves room for error. I would like to eliminate as much user error as possible by automating as much of this as possible. I've googled some lengthy examples of how to do this but was hoping someone with more knowledge than I would be able to provide a quicker fix for this than the 80 to 100 lines that I was able to find. Thanks |
#4
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I'd drop a button from the Forms toolbar on the worksheet and assign this macro
to the button: Option Explicit Sub testme() Dim wks As Worksheet Dim NewWks As Worksheet Dim myPath As String Dim myFileName As String Set wks = ActiveSheet myPath = "C:\" If Right(myPath, 1) < "\" Then myPath = myPath & "\" End If myFileName = "UserInput.csv" 'the first worksheet in a single sheet workbook: Set NewWks = Workbooks.Add(1).Worksheets(1) wks.Range("C:d").Copy With NewWks .Range("A1").PasteSpecial Paste:=xlPasteValues 'avoid the prompt if the file already exists Application.DisplayAlerts = False .Parent.SaveAs Filename:=myPath & myFileName, FileFormat:=xlCSV Application.DisplayAlerts = True .Parent.Close savechanges:=False End With End Sub Ephraim wrote: On Mar 30, 4:11 pm, Dave Peterson wrote: I'd start a new workbook Then back to the original worksheet Edit|Copy columns C:D Edit|Pastespecial|values into A1 of the new worksheet in the new workbook Save this file as the .csv file Close the new workbook. ======== Another option that may work for you: Put a formula like this in E1: =c1&","&d1 and drag down Then copy this column and paste into NotePad. Save that as a .CSV file. Depending what's in those fields, you may want to add double quotes, too. Ephraim wrote: Hi, I have a small spreadsheet with 20 check boxes in Column A (A1-A20). They are all linked to corresponding cells in Column B which give TRUE or FALSE depending on if they are checked or unchecked. No problem there. I have the corresponding check boxes displaying "Computer 1" in cell C1 and so on down to C20 i.e. Formula in C1 is =IF(B1,"Computer 1","") Once the user has checked/unchecked as required then I'd like to be able to save Column C1:C20 and Column D1:D20 to a csv file called "UserInput.csv" Thanks Ephraim -- Dave Peterson- Hide quoted text - - Show quoted text - I'm trying to make this as transparent to the user as possible. The resulting file will be providing input to a powershell 2.0 script. Leaving it to the user leaves room for error. I would like to eliminate as much user error as possible by automating as much of this as possible. I've googled some lengthy examples of how to do this but was hoping someone with more knowledge than I would be able to provide a quicker fix for this than the 80 to 100 lines that I was able to find. Thanks -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
On Mar 30, 8:29*pm, Dave Peterson wrote:
I'd drop a button from the Forms toolbar on the worksheet and assign this macro to the button: Option Explicit Sub testme() * * Dim wks As Worksheet * * Dim NewWks As Worksheet * * Dim myPath As String * * Dim myFileName As String * * Set wks = ActiveSheet * * myPath = "C:\" * * If Right(myPath, 1) < "\" Then * * * * myPath = myPath & "\" * * End If * * myFileName = "UserInput.csv" * * 'the first worksheet in a single sheet workbook: * * Set NewWks = Workbooks.Add(1).Worksheets(1) * * wks.Range("C:d").Copy * * With NewWks * * * * .Range("A1").PasteSpecial Paste:=xlPasteValues * * * * *'avoid the prompt if the file already exists * * * * Application.DisplayAlerts = False * * * * .Parent.SaveAs Filename:=myPath & myFileName, FileFormat:=xlCSV * * * * Application.DisplayAlerts = True * * * * .Parent.Close savechanges:=False * * End With End Sub Ephraim wrote: On Mar 30, 4:11 pm, Dave Peterson wrote: I'd start a new workbook Then back to the original worksheet Edit|Copy columns C:D Edit|Pastespecial|values into A1 of the new worksheet in the new workbook Save this file as the .csv file Close the new workbook. ======== Another option that may work for you: Put a formula like this in E1: =c1&","&d1 and drag down Then copy this column and paste into NotePad. *Save that as a .CSV file. Depending what's in those fields, you may want to add double quotes, too. Ephraim wrote: Hi, I have a small spreadsheet with 20 check boxes in Column A (A1-A20).. They are all linked to corresponding cells in Column B which give TRUE or FALSE depending on if they are checked or unchecked. No problem there. I have the corresponding check boxes displaying "Computer 1" in cell C1 and so on down to C20 i.e. Formula in C1 is =IF(B1,"Computer 1","") Once the user has checked/unchecked as required then I'd like to be able to save Column C1:C20 and Column D1:D20 to a csv file called "UserInput.csv" Thanks Ephraim -- Dave Peterson- Hide quoted text - - Show quoted text - I'm trying to make this as transparent to the user as possible. The resulting file will be providing input to a powershell 2.0 script. Leaving it to the user leaves room for error. I would like to eliminate as much user error as possible by automating as much of this as possible. I've googled some lengthy examples of how to do this but was hoping someone with more knowledge than I would be able to provide a quicker fix for this than the 80 to 100 lines that I was able to find. Thanks -- Dave Peterson Absolutely perfect! Exactly what I was looking for. Thank you very much. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
output to the same line in a Text file? | Excel Discussion (Misc queries) | |||
Lookup 2 columns of data, perform, match, output results | Excel Worksheet Functions | |||
How can I output VBA function results (array's for example) to spreadsheet | Excel Worksheet Functions | |||
Multiple input and output results | Excel Discussion (Misc queries) | |||
Open a print output sent to file | Excel Discussion (Misc queries) |