excel-vba

Restricting the user to delete the cell contents

不羁岁月 提交于 2020-01-06 20:09:56
问题 Is there's any way to restrict the user from deleting the cell contents without using the protect method of excel. I have this code: Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Dim ws As Worksheet Set ws = ThisWorkbook.Worksheets("Sheet1") If Not Intersect(Target, Range("C21:D" & ws.Range("C" & ws.Rows.Count).End(xlUp).Row)) Is Nothing Then Cancel = True MsgBox "You are not allowed to edit!", vbCritical + vbOKOnly EndIf End sub But this only disallows the

VBA - looking through each record

我们两清 提交于 2020-01-06 20:05:36
问题 Struggling a bit with this code, I haven't ever had to reference one column and copy and paste to another tab in VBA so here goes.. I have an excel document with a table on it similar to below: I need my code to look in column A find the first name, in this case, Nicola. I then want it to look at column B and check to see if she has the word "Internet" appear in any of the records stored against her, as she does the code will ignore her and move down to the next name on the list, in this case

VBA: I get the following error: run-time error '1004' Application-defined or object-defined error

南笙酒味 提交于 2020-01-06 20:01:14
问题 Current issue: My code used to work partially until I add extra data to sheet2, now when it fails and debug sends me to: Set partsheet = Worksheets("Sheet1").Range("A1", Range("A65536").End(xlUp)) Utility of this code: I basically have two columns in different sheets: that I want to compare & when similar import data: Sheet1 - column1 is a job number Sheet1 - column2 is a part number for the same job number you can have multiple parts - meaning the job number repeats itself in column1 Sheet2

Excel Advanced Filter Unique Values on a Filtered List - Multiple Criteria

北城余情 提交于 2020-01-06 19:57:26
问题 I am trying to use the Advanced Filter in Excel Unique Values in VBA on an already filter list, but the results I am seeing is not as expected. The problem I have is that the advanced filter for unique values is running over a list of rows that have already been filtered, and when the advanced filter is running it add values that have already been filtered out. To described the problem I have already filtered out non null dates, and another column that contains "-". However, when I apply the

How to Parse XML file in VBA

℡╲_俬逩灬. 提交于 2020-01-06 19:54:54
问题 I have data in the below format and have similar data in Excel sheet. <LegalEntityDataVO> <LegalEntityDataVORow> <Name>Siemens Corporation</Name> <LegalEntityIdentifier>010</LegalEntityIdentifier> <EstablishmentData> <EstablishmentDataVORow> <MainEstablishmentFlag>Y</MainEstablishmentFlag> <Name>Siemens Corporation</Name> <GeographyCode>US</GeographyCode> <RegistrationDataEtb> <RegistrationDataEtbVORow> <SourceTable>XLE_ETB_PROFILES</SourceTable> <Name>United States Income Tax</Name> <

Multiple cells selecting and copying to a single row on another worksheet

人走茶凉 提交于 2020-01-06 19:54:34
问题 I've been looking around for this for the past couple days and can't seem to find anything to help me accomplish what I'm trying to do. I have a sheet that contains data in multiple cells that a user inputs - I would like for when the user hits the submit button that a VBA Macro would copy the data from the multiple cells and paste it into another worksheet on a single row (last row) so I can pull that data later and make changes to it if needed. The worksheet has a unique ID on the top and

Bloomberg - Excel VBA Macro to email Bloomberg <CN> screen via <GRAB>

≡放荡痞女 提交于 2020-01-06 19:54:31
问题 I am looking to develop an Excel-Bloomberg macro. The excel spreadsheet will be linked to a Bloomberg Add-In and of course, a Bloomberg Terminal. The objective of the macro is to have a list of securities in column A which we need to gather ‘company news’ for. The objective of this macro is to provide news as a source of backup for equities moving over a price tolerance. The Bloomberg <CN> Screen is desired. The macro needs to execute to the <CN> (company news) screen of each security listed

VBA treeview loading issue - invalid key

孤街浪徒 提交于 2020-01-06 19:54:11
问题 I want to display the Excel data in treeview but it is showing invalid key. Please assist me. Dim rTWData As Range Dim oRow As Variant Dim onode As Variant Dim lastrow As Integer Dim myFileNameDir2 As String Dim ws12 As Worksheet Dim i2 As Integer Dim lastrow2 As Integer Dim filecheck As Variant myFileNameDir2 = Sheet1.Range("V5").Value Workbooks.Open Filename:=myFileNameDir2, UpdateLinks:=0 Set ws12 = Worksheets(1) lastrow = ws12.Range("A" & Rows.Count).End(xlUp).Row - 1 Set rTWData = ws12

VBA Autofilter Excel 2013?

让人想犯罪 __ 提交于 2020-01-06 19:52:44
问题 I've been using a line like: Cells.AutoFilter 11, "0" for a while to autofilter column 11 for "0". I recently updated to Microsoft Office 2013 and now I'm getting an AutoFilter method of Range class failed runtime error with this line. Is this a compatibility issue with Office 2013 or some other problem? EDIT: I should clarify that I am not getting an error with a program I already run, but rather a line which I've used before and is not working for me right now. EDIT2: Code: Dim firstRow As

Automating File Download of a link that looks like this: https://www.domain.com/TableData/TableA.csv

耗尽温柔 提交于 2020-01-06 19:49:11
问题 I am trying to write an application that will download .csv and .xls files and save them into a folder that will be accessed later by a VBA macro. I am posting this question after the unsuccessful use of the solution in the following link: How do i download a file using VBA (Without internet explorer) The macro runs successfully, but the downloaded .csv file only contains the html from the login page. I find that strange because when I copy and paste the link directly into the browser without