excel-vba

Opening tsv file via Notepad++ and save it in text format

夙愿已清 提交于 2020-01-24 01:49:14
问题 I'm trying to automate a process that where in a folder there are 50+ tsv files. They have to be opened via notepad++ and save it as .txt file in the same folder. Using the below code i'm opening the tsv file in notepad++. MyTxtFile = Shell("C:\Program Files (x86)\Notepad++\notepad++.exe I:\Test\Sample.tsv", 1) However, i have no idea how to save it as txt file by using VBA. Is it doable? If yes kindly teach me how. Thank you in advance :) 回答1: If you only want to rename the files from *.tsv

Excel auto save macro doesn't execute when cursor is active in a cell

随声附和 提交于 2020-01-24 00:53:27
问题 I have a macro which auto saves the workbook every 5 minutes to avoid losing data. The workbook is set up with a data connection to collect production data from a PLC controller and production operators can also enter notes into the workbook. The problem is that if someone started entering a note but didn't confirm the entry by pressing enter or tab or by clicking on a different cell then the auto save macro will not execute and the workbook will not be saved until the focus changes to

VBA code to Filter data automatically by windows log-in user ID?

浪子不回头ぞ 提交于 2020-01-24 00:20:08
问题 I got VBA code that runs sql server stored proc, brings data into excel. EX: Excel Data: Id Division Department Scale 1 North IT 8.5 2 South Finance 8.0 3 North Finance 8.0 4 West IT 8.5 5 East Finance 8.0 6 South IT 8.5 Now I got a situation that is: If one user from North runs the VBA macro, the excel result should only show Division North. If users from South runs VBA macro, the excel result should only show Division South. EX: If one user from South runs VBA macro, the result like Id

Apply formula in VBA?

三世轮回 提交于 2020-01-23 19:47:47
问题 I am trying to apply a formula that writes YES or NO in a cell checking if another cell starts with Q) text. Writing it manually in Excel is working. =IF(LEFT(A2;2)="Q)";"YES";"NO") But when I try to do it automatically inside a macro Range("R2").Formula = "=IF(LEFT(A2;2)=""Q)"";""YES"";""NO"")" Run-time error '1004': Application-defined or object-defined error Also, I will want to do it for the whole column, something like this Range("R2:R" & lastRow).Formula = "=IF(LEFT(A2;2)=""Q)"";""YES""

Delete rows based on condition in a column

雨燕双飞 提交于 2020-01-23 17:23:06
问题 I've searched online and on here but can't find anything which seems to fit the bill and work. I have got some code which works but because the length of the range changes as it deletes rows it doesn't catch all of the rows to delete and so I end up running it several times which isn't great...so I'm now trying the AutoFilter approach as recommended on this thread. I have a spreadsheet with several columns, one of which is 'cost'. I need to go through the 'cost' column (which can sometimes be

Amazon FBA Offers extraction using VBA

拥有回忆 提交于 2020-01-23 17:12:45
问题 I am using below mentioned code to extract data from amazon. Sub Macro1() ' Macro1 Macro With ActiveSheet.QueryTables.Add(Connection:= _ "URL;http://www.amazon.com/gp/offer-listing/B00N41UTWG/ref=olp_f_new?ie=UTF8&f_new=true" _ , Destination:=Range("$A$1")) .Name = "oldOfferPrice" _ ' "its_details_value_node.html?nsc=true&listId=www_s201_b9233&tsId=BBK01.ED0439" .FieldNames = True .RowNumbers = True .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False

Amazon FBA Offers extraction using VBA

女生的网名这么多〃 提交于 2020-01-23 17:11:15
问题 I am using below mentioned code to extract data from amazon. Sub Macro1() ' Macro1 Macro With ActiveSheet.QueryTables.Add(Connection:= _ "URL;http://www.amazon.com/gp/offer-listing/B00N41UTWG/ref=olp_f_new?ie=UTF8&f_new=true" _ , Destination:=Range("$A$1")) .Name = "oldOfferPrice" _ ' "its_details_value_node.html?nsc=true&listId=www_s201_b9233&tsId=BBK01.ED0439" .FieldNames = True .RowNumbers = True .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False

Macro to Export Certain Excel Sheets to Separate PDF

我们两清 提交于 2020-01-23 14:14:36
问题 I have a macro to export certain sheets in a workbook to separate PDF's (for reporting purposes). It works properly for me in one workbook, however, in a different workbook it is exporting ALL sheets. I can't figure out where I am going wrong. To make things easier, I italicized the spots where I would customize it for my purposes. Sub ExportToPDFs() ' PDF Export Macro ' C:\ *location* ' Sheets(Array("*selected sheets*")).Select Dim nm As String Dim ws As Worksheet For Each ws In Worksheets

Create and Write to a text file using an excel macro and VBA

回眸只為那壹抹淺笑 提交于 2020-01-23 13:25:06
问题 I am using a macro and VBA code to create a text file with a specific format. All the data needed to create the text file is gathered from the macro cells. I have attached pictures of the macro data file and the output text file (please see below). excel macro with data Desired output txt format-example Also, below is my VBA code I generated to get data from the macro and create/write into a text file. I still need to figure out how to write it in the specified format (Desired output txt

excel vba to upload file to sharepoint

别等时光非礼了梦想. 提交于 2020-01-23 12:04:40
问题 I am trying to upload a folder from my C drive to a SharePoint library site. I have used the below code, which works fine when the ToPath is not a SharePoint library site but another folder from my C drive. Where am I going wrong? Sub AddSharePointFiles() Dim FSO As Object Dim FromPath As String Dim ToPath As String ToPath = "https://share.name.com/site/folder/_layouts/15/start.aspx#/LibraryName/Forms/AllItems.aspx" FromPath = "C:\Users\Name\Documents\FolderName" Set FSO = CreateObject(