excel-2010

Delete entire row if cell contains the string X

折月煮酒 提交于 2019-11-27 00:52:39
问题 I am new to VBA and I am trying to come up with a way to delete all rows (and shift cells up, if possible) where the website column cell contains the word none . The table contains 5000+ records and this would save me a great amount of time. I appreciate any suggestions. Many thanks in advance! 回答1: This is not a VBA task - This specific task is easiest sollowed with Auto filter. 1.Insert Auto filter (In Excel 2010 click on home-> (Editing) Sort & Filter -> Filter) 2. Filter on the 'Websites'

VBA error 1004 - select method of range class failed

别说谁变了你拦得住时间么 提交于 2019-11-26 23:07:30
问题 First time poster, so if there is any formatting, or guidelines I failed to adhere to, please let me know so that I can fix it. So I am basically asking the user for the file directory of the excel file, then I setup some variables (originally set at public as project variables, since these were being used and changed in other places). I have also added the lines to set these variables to nothing (just in case, I do not think that it should matter). I then set these variables to the excel

Copying and pasting data using VBA code

浪尽此生 提交于 2019-11-26 21:18:57
问题 I have a button on a spreadsheet that, when pressed, should allow the user to open a file, then copy columns A-G of the spreadsheet "Data", then paste the data from those columns on the current sheet. I have a logic error in the code; it runs, but it pastes the selection in the wrong place. I am having trouble referencing the two workbooks. Here is my code: Sub Button1_Click() Dim excel As excel.Application Dim wb As excel.Workbook Dim sht As excel.Worksheet Dim f As Object Set f =

Should I turn .CutCopyMode back on before exiting my sub procedure?

六眼飞鱼酱① 提交于 2019-11-26 20:48:23
In order to optimize my code, I turn off several Application Object member properties; one in particular being the .CutCopyMode property . Sub MyProcedure() With Application .ScreenUpdating = False .EnableEvents = False .CutCopyMode = False End With ' lots of code here Should I turn .CutCopyMode back on (e.g. True) again with the others before my sub finishes? ' lots of code here With Application .ScreenUpdating = True .EnableEvents = True .CutCopyMode = True '<~~ ??? End With End Sub The short answer is that Application.CutCopyMode = True either does nothing at all or it does the opposite of

Running multiple async queries with ADODB - callbacks not always firing

自作多情 提交于 2019-11-26 20:27:10
问题 I have an Excel workbook that fires three queries to a database to populate three tables on hidden sheets, and then runs three 'refresh' scripts to pull this data through to three visible presentation sheets (one per query). Running this synchronously is quite slow: The total time to refresh is the sum of the time of each of the three queries, plus the sum of the time for each 'refresh' script to run. I'm aware that VBA isn't multi-threaded, but I thought it would be possible to speed things

What are .NumberFormat Options In Excel VBA?

五迷三道 提交于 2019-11-26 19:43:40
Can you please let me know what are the .NumberFormat format options in Excel VBA? As you are fully aware Excel 2010 supports the following types: I know that we can set for example Text type as: .NumberFormat ="@" or for number: .NumberFormat = "0.00000" Can you please let me know what are other options for types in VBA? Note this was done on Excel for Mac 2011 but should be same for Windows Macro: Sub numberformats() Dim rng As Range Set rng = Range("A24:A35") For Each c In rng Debug.Print c.NumberFormat Next c End Sub Result: General General Number 0 Currency $#,##0.00;[Red]$#,##0.00

Converting Time Formats in Excel

↘锁芯ラ 提交于 2019-11-26 18:39:51
问题 How would I convert time values that are output in as a string (21m49s) into the Excel time value (00:21:49)? If there is no hour value to be given, the cell is not assigned a 0h value. It will display only minutes and seconds in that case. Will also need to account for readings above 60 minutes which would display as 1h34m14s. This is how I receive the time values: This is what I need them to look like: 回答1: Try this: =TIME(IF(ISNUMBER(FIND("h",A1)),LEFT(A1,FIND("h",A1)-1),0),IF(ISNUMBER

How to Split a single cell into multiple rows and add another row

不羁的心 提交于 2019-11-26 18:34:02
问题 I have a table that has two Columns. Date and Test Name. What I would like to happen is that the string of text in one single cell be separated into multiple rows. In addition, I need the date to be associated with each set of text. I have tried text to columns and then transpose, but it can only handle 1 set of string at a time and not the entire data set. 回答1: Loop through Column A then loop through the string next to it. Results will be in column D Sub ChickatAH() Dim rng As Range, Lstrw

Excel VBA Run-time Error '32809' - Trying to Understand it

£可爱£侵袭症+ 提交于 2019-11-26 18:26:50
问题 A colleague at work made some changes to one of our macro workbooks and now on my PC only I receive the dreaded Run-time Error '32809' when I attempt to run it. This latest version runs fine on his PC and another colleague's PC that we tested it on. The previous version runs fine on all of our PC's, all of which are running Excel 2010. The error is thrown when the macro attempts to Select the Worksheet index 1, named "Info". I know that Select/Activate is not required but am just working with

How to highlight a cell using the hex color value within the cell?

老子叫甜甜 提交于 2019-11-26 17:32:17
问题 I have a spreadsheet of symbols and matching hex colors. I want to fill the cell itself (or the one next to it) with the hex color within the cell. I've read a bit about "conditional formatting", and I think that's the way to do it. How might I achieve the result I would like? 回答1: Can't be achieved with Conditional Formatting for all colours. Assuming: Row1 contains Data Labels, data set does not have gaps, the HEX colour is for the fill not the font, you have parsed the HEX colour values