excel-vba

Excel Question: I need a date and time formula to convert between time zones

Hello, I am trying to find a way to calculate a duration in days between my, time zone (Central), and (Pacific; Mountain; Eastern). Just do not know where to start. My criteria would be as follows: Cell C5:C100 would be the timestamps in this format:3/18/2010 23:45 but for different dates and times. Cell D5:D100 would be the correspo...

Excel 2003 - How to build my own XLA?

How can you make the .xla file if you want to create your own xla? I have the code, classes, shapes, etc....what is the process to making an xla file to point to? I know that I have to put it in my program files folder, and then go through the steps to adding an "add-in" in xls...but i mean actually saving an xla file to point to.... ca...

Is it possible to copy a macro from one Excel workbook to another using VBA?

I would like to copy a macro from one Excel workbook to another using VBA. Is this possible? If so, how? ...

Can an Excel VBA UDF called from the worksheet ever be passed an instance of any Excel VBA object model class other than 'Range'?

I'm 99% sure that the answer is "no", but I'm wondering if someone who is 100% sure can say so. Consider a VBA UDF: Public Function f(x) End Function When you call this from the worksheet, 'x' will be a number, string, boolean, error, array, or object of type 'Range'. Can it ever be, say, an instance of 'Chart', 'ListObject', or any...

Replace or recode several different values by a single value in an Excel file

Hi all, I have an Excel worksheet which contains data in several columns. For a specific column, I will need Excel to replace all values between, say 10 to 15, by the value 1 and values between 16 and 20 by the value 2 and so forth. I know how to do it for a single value; ie: I can replace value 10 by 1, 11 by 1 and so on. But this wil...

How to open CSV file with VBA macro

I have CSV file and Macro in VBA. I want to open CSV file in Excel and automatically launch a macro which creates a chart. Is it possible? How to do this (Using language: Java)? ...

Insert into Oracle from Excel VBA

Hi, I'm using ADO object to connect oracle database. When I execute an INSERT statemnet from VBA it is getting inserted properly. If I check the same record with the current connection, I am able to retrieve the inserted data. But when I check the same directly in Oracle it is not reflecting that inserted Data. For cross verification, ...

Excel: Inserting data and not autoformat in vba

The data I am trying to insert is from a database, and while inserting the data it gets auto formatted to scientific format, is it possible not to auto format it? I don't want it to be in scientific format but in text format Example that gets auto formatted: 20.E01 ...

Manipulating excel "autoshapes" with VBA

I am trying to write a macro in VBA (Excel) that is assigned to a Checkbox. Whenever the checkbox is clicked, an "autoshape" will change its "order" from "Send to Back" to "Send to Front". Basically, I am trying to create a dashboard with multiple panels, so that users can access information without moving between sheets. Each panel wi...

Excel VBA: how to insert a new row into a range and copy formulas

Hi There I have a named range like the following covering A2:D3 ITEM PRICE QTY SUBTOTAL 1 10 3 30 1 5 2 10 TOTAL: 40 I am looking for some VBA code to insert a new row into the range copying the formulas not values. Any tips/links greatly appreciated. ...

How to copy data from another workbook and paste onto related group rows?

Hi there, How do I copy data from all the workbooks in the folder onto workbook 1 into it's corresponding row groups? The attached images shows the sample worksheet is the file I want to paste data into (main template) and wb2 sample is a sample of one of the worksheets in the folder that I want to copy data from. As you can see, the ...

How to prevent Excel from wanting to start in Safe Mode?

We have a background process that calls Excel for generation of report spreadsheets. Occasionally, a crash or inadvertent server reboot will occur while Excel is running. The first launch of Excel after the restart brings up the dialog box (paraphrasing here) "Would you like to start Excel in safe mode?" (Yes/No) The issue is that our b...

Excel / VB - How do I loop through each row/column and do formatting based on the value?

Here's what I need to do: 1) Loop through every cell in a worksheet 2) Make formatting changes (bold, etc) to fields relative to each field based on the value What I mean is that if a field has a value of "foo", I want to make the field that is (-1, -3) from it bold, etc. I tried to do this with the following script with no luck. Than...

allow two possible values in a excel cell

Hi, I would like to create a cell format for one cell to only allow the value "yes" or "no" for this cell. How could i do this? Thanks in advance. Jose ...

Excel Macro to copy an entire row from one sheet to another based upon a single word, within a paragraph, inside a cell

Guys i'm looking for a simple excel macro that can copy a row from one sheet to another within excel based upon having a specific word in the cell. I have a sheet one, called "data" and a sheet two called "final". Here is an eaxmple of the data A B C D john mary 555.555.4939 initial rep...

how to get the list of Function and Sub of a given module name in Excel VBA

I am working on a helper macro that look into the list function on a given module name on the active excel workbook. Ex: I have a module name "Module1". Inside this module has the following function or sub Sub Sub1() End Sub Sub Sub2() End Sub Function Func1() End Function Function Func2() End Function Is there a command or routine...

Navigate a website with Excell Vba

I can pull data from known ulr, but can I navigate a website with excel. For example can excel do a google search and put the results on a spreadsheet. Or navigate an in-frame site. This code pulls data from a website. With ActiveSheet.QueryTables.Add(Connection:= _ PUT_URL_HERE, _ Destination:=Range("A1")) .Name = "I need...

VBA Excel: Issue with Zorder /Help with Debugging Code

Hi, I have multiple shapes and checkboxes in a spreadsheet. I want to create a function that places a particular shape to front (a higher Z-order than its peers) when its corresponding checkbox is clicked. This is the code that I currently have: Sub CheckBox3_Click() If CheckBox3.Value = True Then Sheet1.Shapes("blueoval").ZOrder msoB...

VBA Excel To SqlServer

What is the best way to write VBA code to connect to SQL Server 2005 from Excel? The users of the excel file might run XP, Vista, Win7 and I want to prevent driver installation as much as possible. My understanding is that XP uses MDAC while Vista/Win7 uses DAC. Does that mean that a reference to MDAC 2.8 will not work on a Vista machi...

Problems with Application.OnTime in Excel's VBA

I am trying to run a certain macro in very short intervals (every second, and, yes it works and does not freeze the system) from a certain time until a certain time. This means I need a starting point and a cutoff point. I cannot use the Workbook_Open() Event, since I already have other macros triggering at different times after the open...