excel-vba

Excel Macros - How do I get Range of AutoFiltered rows?

OK, so I have set AutoFilter property for the whole of the active worksheet (UsedRange.AutoFilter Field:=1, Criteria1:= [blah blah]) Once the filter is applied, how do I programmatically select the range if rows and columns that are the result of the filter. I checked UsedRange, but that gives the whole (unfiltered) range. Any ideas? ...

Creating a sublist based on a second column in excel

I have two columns, the first column will have the name of a object, the second is who it belongs to. I want a new sheet for each person to list what they had assigned to them. here is a example: dog F cat F bell S whistle bird F So Fred has a dog, cat, and a bird; Scott has a bell; and no one has a whistle on their page. Now doing a...

Adding Code to a Command Button that was dynamically added to a frame in a user code

Hi, This is a vba question. I found the question: "Adding controls to a frame in an Excel userform with VBA" and used its method to add commandbuttons to my frame in my user form. Since I added four commandbuttons, I ran the code in a loop, and used the With ... .Name = "commandbutton" & x to give each command button its own ...

Excel VBA to VB (DCOM)

I inherited an Excel VBA spreadsheet. I have been tasked to convert it to VB. The application acquires data from a PLC using a DCOM object (I think). The following code runs the sub SBR1Select when MX1.0 is updated. Sub Workbook_Open() ActiveWorkbook.SetLinkOnData "dassidirect|strandburner!MX1.0", "SBR1Select" End Sub When I op...

how to save the value in text field on vba for excel

http://www.uppic.net/show/6cf3ef68b9497ab919e69f315e8d4b50 like the figure when you want to change username and password and you can save the value in text field after that in new form , the value can be changed to new value that already enter like the figure below http://www.uppic.net/show/a46ad9a74d8835dcdef3aa5e732bd04c ...

Assigning a cell a variable without deleting it's original contents...

Hi, I'm setting up some VBA in excel to compare two dates to see if they're the same. The problem I'm having is that after assigning the cell's variable to "ActualStartDate", it deletes everything from the cell. So "ActualStartDate" is assigned correctly, but deleted at the same time. Here's my code, any help would be fantastic. (this ...

Multiple developers in a VBA project

My understanding of VBA is that one office document contains a suite of VBA functions, all stored within the same file as the data. Is it possible to have more than one developer modify this code at once? In a conventional software development project, the code is distributed amongst multiple text files. Developers can modify and check...

Excel automation - Select all active cells

I have an app where I put a lot of data into an Excel Worksheet. Once I'm done, I would like to select all the cells from the top left to the bottom right where I have put data in. E.g. say I put data into A1, A2, A3, B1, B2, B3, C1, C2, C3 (a 3x3 grid). How can I select just this grid (and not the entire sheet). I guess by saying someth...

Macro Plug in

Currently this macro is set up so that if Column G has “Last Term” and “Okay” or “Okay” and “Stay” next to each other 07a will be entered into the same row in Column I. I would like to modify this code so that If Column G contains “Last Term” and Column K contains “Okay” and “End” or “Okay” and “Stay” in any combination or in any order...

Multiplying multiple cells by a number

If I have a block of cells such as A1:D5, what's the quickest way of multiping each cell by another number, 1.1? ...

Is it possible to add VB to an Excel sheet from POI?

Does anyone know if it's possible to add VB to an Excel document, from within Java? I basically want to add a pivot table to a sheet, and set some of it's properties dynamically. I know that I can access the pivot table settings from VB, but not directly from POI. ...

Selecting non-blank cells in Excel with VBA

I'm just beginning to dive into VBA and I've hit a bit of a roadblock. I have a sheet with 50+ columns, 900+ rows of data. I need to reformat about 10 of those columns and stick them in a new workbook. How do I programmatically select every non-blank cell in a column of book1, run it through some functions, and drop the results in book...

Copy worksheet macro stops doing anything when the workbook hits 50 worksheets

Hey all I have a workbook that has a number of cover sheets and then a bunch of sheets at the back that are contain a few graphs. The graph pages are created by copy-pasting one sheet ("MasterFormat") over and over again, changing a few key values each time. The macro originally used to conk out fairly rapidly with a Copy Method of Wo...

VBA Excel 2007 : How to sum all the digits in a paragraph (text in a cell)

I have an excel sheet (see image below) Here the requirement is to get the sum total of all the digits in the cells in column 'C' and put the value in the corresponding cell in column 'B' (in my example - 1 + 0.25 + 0.25 + 1 = 2.5). The values in the Column 'C' could change dynamically based on the inputs given by the team. The require...

Excel VBA to Open Multiple Word files in a loop

Hello, I apologize in advance for the newbie question -- most of my VBA experience is in Excel, or Word to Excel. In this case, I am going from Excel to Word. I am trying to capture some data off of some Word forms and store it in an Excel file. Right now, my code works for the first document in the folder, but after that, it hoses up...

Extracting VBA from a Excel spreadsheet

Is there a clean way to extract the VBA from a spreadsheet and store it in a repository. The spreadsheets hardly ever change but the VBA does. Storing the whole spreadsheet in the repository makes it difficult to do diffs across the different VBA revisions to see what code has changed and who changed it. We use VBA 6.5 / Excel 2003. ...

merged cell's contents cut off beyond page break

I have a vb .net program that exports information to certain fields of an excel workbook using named ranges. One of the named ranges is a notes section that gets cut off (not visible nor gets printed) if it extends beyond a page break. I am looking for a way to dynamically create new named ranges to accommodate all of the notes' text. S...

formatting in Excel from VB6

hi experts I am using the Excel Automation to create a excel sheet and write data to it.. I want to know how i can make only particular cells to BOLD and how i can make the cell size to autofit to its contents.. Pls help ...

Does MS Excel use Macros internally?

I have always wondered if whatever actions we do are actually translated into VBA Macros before it is executed. Is that how we are able to record macros? If not, would you call it a redundancy in design? Would it be faster/slower it ain't the way it is now? ...

Excel/VBA to check if a row exists

I have a sheet full of some raw data, about 20,000 rows and 50 columns. (Number of rows expected to increase, probably double if not triple) I need a formula to look at this data and determine if a row exists for data in two specified columns. My current formula is as follows. Function CheckExists(Table As Range, SearchCol1 As Integer,...