excel-2010

How do you select the entire excel sheet with Range using Macro in VBA?

风流意气都作罢 提交于 2019-12-02 23:46:50
I found a similar solution to this question in c#... See link below How to Select all the cells in a worksheet in Excel.Range object of c#? Does anyone have a snippet to do this in VBA? I'm not really familiar with VBA, so this would be helpful. Here's what I've got so far... I select data normally by using "ctrl+shift over arrow, down arrow" to select an entire range of cells. When I run this in a macro it codes out A1:Q398247930, for example. I need it to just be .SetRange Range("A1:whenever I run out of rows and columns") This is very simple, and I could easily do it myself without a macro,

Copy a worksheet to a new workbook and have a button point to the macro in the NEW workbook?

爱⌒轻易说出口 提交于 2019-12-02 23:10:10
问题 I have a worksheet that looks like a form. It has a "Reset" button to clear the values. There is a macro that I can run that copies that sheet into a new Workbook and emails it to someone. The module that contains the macros gets copied into it and all is almost ok. The problem is, the button on the worksheet that runs the reset macro still points back to the original document. How can I have it point to the macro within itself? Edit: One thing to point out is that I do have macros within

Extract pictures from Word and Excel with Python

寵の児 提交于 2019-12-02 22:20:35
问题 I was searching for a way to strip out pictures from these file types and this is the solution I came up with. It iterates through a given directory structure, copies any files with the proper extension, and renames the copy to filename.zip. Then it navigates through the zip structure and extracts all picture type files with the proper extension, and renames them to the original file name, with a number for uniqueness. Finally, it deletes the extracted directory trees it created. Extracting

Dependent Drop Down List Excel - Unique Values

﹥>﹥吖頭↗ 提交于 2019-12-02 21:18:57
问题 I need to connect three lists of data and put them into drop down lists. So I started by making named ranges, getting all of the unique values and such. Essentially I followed the instructions on this website: http://www.get-digital-help.com/2010/07/17/create-dependent-drop-down-lists-containing-unique-distinct-values-in-excel/ After following the website, I placed these three drop downs all in the same row, one cell apart. HOWEVER, now I need to have the same three drop down sequence in the

Excel 2010 VBA. Concatenate 2 columns from a Sheet and paste them in another

∥☆過路亽.° 提交于 2019-12-02 20:38:28
问题 Using Excel 2010, I'm trying to create a script that concatenates two text columns (A and B) from Sheet1 and pastes the result in column A of Sheet2. The workbook uses an external datasource for loading both columns, so the number of rows is not fixed. I've tried the following code, but not working. variable lRow is not taking any value. Sub Concat() Sheets("Sheet1").Select Dim lRow As Long lRow = Range("A" & Rows.count).End(xlUp).Row For i = 2 To lRow ActiveWorkbook.Sheets("Sheet2").Cells(i,

Naming an array using a variable

江枫思渺然 提交于 2019-12-02 19:59:22
问题 Is it possible to name an array variable using a different variable? For example, if I define variable "i" as an integer with a value equal to the number of columns I've used it a sheet: Sub varNameTest Dim i, j, As Integer i = ActiveSheet.UsedRange.Columns.Count ... Is it possible to then establish "i" number of arrays named something like myArray1 through i? Possibly something like: For j = 1 to i Dim (myArray & j()) Next i Though this example immediately above is incorrect syntax, I'm just

Excel template: import CSV in batch mode

回眸只為那壹抹淺笑 提交于 2019-12-02 19:41:07
问题 I need to create a template (MS Excel) for importing CSV data (error log) in Excel. I have set the conditional formatting that if a call value is greater than 0, the cell color must automatically change to RED while for value=0, the cell color must be green. I saved the file as Excel template. Now I want to import CSV data into a new XLSX document created from the template above (with conditional formatting), in batch-mode, and safe the result automatically. I am using following command: "C:

Round Up the value to lowest in microsoft excel

穿精又带淫゛_ 提交于 2019-12-02 19:19:28
问题 I am writing a formula in excel in which I am diving 2 numbers and I don't want value in decimal. I tried using ROUND(5/10,0) but it round of 0.5 to 1. But my requirement is (0-0.99) should be evaluated as 0. Similarly (2-2.990 should be evaluated as 2. E.g. (5/10) - 0 (output) (15/10) - 1 (output) (25/10) - 2 (output) Thanks in Advance. 回答1: You can use the function ROUNDDOWN . Example: ROUNDDOWN(15/10,0) The second parameter stands for the precision. Zero means that you won't have any

Find all and delete in VBA

你。 提交于 2019-12-02 18:04:59
问题 I am looking for a way to find all - in a column in VBA, store them or and delete the rows? Here is what I can use to find and delete a single row. But I need to find all of the dashes. Dim A as Long Columns("C:C").Select Selection.Find(What:="-", After:=ActiveCell, LookIn:=xlValues, LookAt:= _ xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _ , SearchFormat:=False).Activate A = ActiveCell.Row Range(A).Delete I thought about a loop but I don't know how many times to

Formatting List of Text Strings in Excel

百般思念 提交于 2019-12-02 17:42:23
问题 I am trying to turn the font to red for the occurrences of a list of words in excel. So far, I am able to find a single word, but I need to search for a whole array. I am a newbie with VBA and struggling. So far, I've been able to find this as a solution, but it deals with finding a single string, "F1": Sub test4String2color() Dim strTest As String Dim strLen As Integer strTest = Range("F1") For Each cell In Range("A1:D100") If InStr(cell, strTest) > 0 Then cell.Characters(InStr(cell, strTest