excel-vba

Macro for merging cells

蓝咒 提交于 2020-01-17 16:37:10
问题 I have an Excel file with Invoice number in Column B, ( B2:B14987 ), in Column C I have Item ID's, in Column D I have Sold Value, in Column E I have Invoice-Discount Value. I need a macro to merge the Invoice Discount value cells based on Invoice number column, invoice numbers are repeated as there are different item ID's in one invoice. For example: B1:B3 are the same invoice number, E1 is the common discount value for the invoices which are in B1:B3 , E2:E3 are blank cells. So I want E1:E3

Excel VBA Workbook Update

跟風遠走 提交于 2020-01-17 16:35:14
问题 I currently have a workbook with a macro to update a range from an identical range on a master sheet. Right now, I simply use a macro to open the master workbook, copy the range from it and paste the values in the same range in the other workbook. Here is the code I am currently using: Sub GetDataFromClosedWorkbook() 'Created by XXXX 5/2/2014 Application.ScreenUpdating = False ' turn off the screen updating Dim wb As Workbook Set wb = Workbooks.Open("LOCATION OF FILE", True, True) ' open the

Pass VBA Variable into Access Query(Excel VBA)

不想你离开。 提交于 2020-01-17 14:59:28
问题 Im new at trying to construct queries out of vba. I am trying to figure out how to pass a variable inside the VBA syntax. Mind showing me where im dumb? I tried this below but there's an automation error that pops up. Ive noticed from playing aroudn that automation errors come up when youve just got syntax wrong, so hopefully its something small? Any help is greatly appreciated Sub GetDataFromAccess() Dim cmd As New ADODB.Command, rs As ADODB.Recordset Dim recordNum As Integer recordNum = 7

Pass VBA Variable into Access Query(Excel VBA)

好久不见. 提交于 2020-01-17 14:58:12
问题 Im new at trying to construct queries out of vba. I am trying to figure out how to pass a variable inside the VBA syntax. Mind showing me where im dumb? I tried this below but there's an automation error that pops up. Ive noticed from playing aroudn that automation errors come up when youve just got syntax wrong, so hopefully its something small? Any help is greatly appreciated Sub GetDataFromAccess() Dim cmd As New ADODB.Command, rs As ADODB.Recordset Dim recordNum As Integer recordNum = 7

Macro to copy to next blank row on another sheet

…衆ロ難τιáo~ 提交于 2020-01-17 14:56:27
问题 I'm using this macro to copy from one sheet to another based on text in one cell, but it overwrites the data every time I run the macro. Is there any way to change the macro so that any data it pastes is in the next blank row? Thanks :) Sub CopyYes() Dim c As Range Dim j As Integer Dim Source As Worksheet Dim Target As Worksheet ' Change worksheet designations as needed Set Source = ActiveWorkbook.Worksheets("Main Data") Set Target = ActiveWorkbook.Worksheets("Cheque Data") j = 1 ' Start

VBA search for a specific subfolder in many folders and move all the files in it

▼魔方 西西 提交于 2020-01-17 14:04:35
问题 can you help me? i want a macro vba that search for a SPECIFIC subfolder for example (Xfolder) between all the folders and subfolders that exist and move their files. P:\Desktop\Folder1\subfolder\SUBFOLDER1\Xfolder I'm using the VBA Scripting Runtime objects Set oSourceFolder = fso.GetFolder(source) If Dir(destinationFolder, 16) = "" Then MkDir (destinationFolder) For Each oFile In oFolder.Files If Dir(destinationFolder,16) = "" Then fso.MoveFile oFile.Path, destinationFolder End If Next

ActiveX Button Renaming

做~自己de王妃 提交于 2020-01-17 13:49:47
问题 First, I am aware of the nearly ubiquitous issue with ActiveX controls and the Dec 2014 MS Excel update. This appears to be different than the common symptoms, but it may be related. Symptoms: Open an existing excel sheet that contains an ActiveX control. Click the button and nothing happens (macro does not launch) Investigation shows that the button name has changed from "BtnMacroLaunch" to "CommandButton3" I open the file on other users machines and the button has NOT been renamed and it

Delete Blank Rows After Data When The Worksheet Varies In Length

大城市里の小女人 提交于 2020-01-17 12:48:11
问题 I have an excel worksheet where I have sorted into date order and this leaves an awful lot of blanks at the bottom of the spreadsheet which I would like to delete but leave the final two. ( the one at the very bottom is formatted blue to the height of 6 and the one just above is blank and also to the height of 6 ). The data is stored from A5 to J and varies in length - tab name is Date Order Does anyone know of any VBA code that will help with this problem. Any help would be greatly

Delete Blank Rows After Data When The Worksheet Varies In Length

末鹿安然 提交于 2020-01-17 12:44:44
问题 I have an excel worksheet where I have sorted into date order and this leaves an awful lot of blanks at the bottom of the spreadsheet which I would like to delete but leave the final two. ( the one at the very bottom is formatted blue to the height of 6 and the one just above is blank and also to the height of 6 ). The data is stored from A5 to J and varies in length - tab name is Date Order Does anyone know of any VBA code that will help with this problem. Any help would be greatly

Delete Blank Rows After Data When The Worksheet Varies In Length

怎甘沉沦 提交于 2020-01-17 12:44:10
问题 I have an excel worksheet where I have sorted into date order and this leaves an awful lot of blanks at the bottom of the spreadsheet which I would like to delete but leave the final two. ( the one at the very bottom is formatted blue to the height of 6 and the one just above is blank and also to the height of 6 ). The data is stored from A5 to J and varies in length - tab name is Date Order Does anyone know of any VBA code that will help with this problem. Any help would be greatly