excel-vba

Sort Excel Grouped Rows

I have a spreadsheet that has information in groups. The header row contain company names and information and then the grouped rows beneath them contain names of people in the company. Company Name | Number of Employees | Revenue | Employee Name | Email | Phone Is there anyway to sort by the number of employees and/or reve...

Sending Data from Excel to a Website

I have been asked to make a Macro which sends the Excel Data to a Website. There should not be any database involved. I have been trying to use HTTP Post after reading examples on this website. I have made a ASP.NET webpage which runs on localserver. While debugging the macro, the control does reach the webpage Page_load event but I am u...

Easy way to find cell reference in excel vba

Hi, I am working on a spreadsheet with lots of VBA code in it. Most cell references use numbers, e.g. Worksheets("Sheet1").Cells(someRow, someColumn) I am wondering if there is any easy way to find out exactly which cell is being referenced - is it possible to put a breakpoint on this line of code, and then see which cell it will ref...

What could cause Shape.Cut to fail in Excel VBA?

Hi all, I have a method in my macro that executes the following code: Set myDocument = Worksheets("sheet1") For each sh in myDocument.Shapes If sh.Name = "square" Then sh.Cut End If Next My problem is that the code causes an error on the line sh.Cut. I know that there is a shape called "square" - I can see (visually) ...

Can't assign range using .End(xlDown) in Excel VBA?

Hi, I've inherited some VBA code (non-.NET, Excel 2003) I have to modify. I want to obtain a handle on a cell range but VBA doesn't like my syntax, saying 'Run-time error 424: Object required'. When running this code it highlights the line assigning streamsTotal. Private Sub totalStreams() Dim streams, streamsTotal As Range ...

Excel 2007 conditional formatting - how to get cell color?

Hi, Let's assume i have the following range from (a1:c3) A B C 1 -1 1 1 2 -1 0 0 3 0 0 1 Now i have selected the following range, and formatted it using Conditional Formatting (using default red yellow green color scale).... now range colors became A B C 1 Green Red Red 2 Green Yellow Yellow 3 Yellow ...

How to implement Excel vbA in C#

Can you help me rewriting the following Excel VB code to C#? Range("C9:E11").Select Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _ Formula1:="=1" Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority With Selection.FormatConditions(1).Interior .PatternColorIndex = xlAutomatic ....

How to convert a simple string to Byte Array in VBA?

I need to convert a simple string in a Byte array using excel VBA. Then this byte array is used as the request's body. How can I do that? Thanks. ...

MS-Excel: How to show the value of a combo box inside a locked cell.

Background Details I have an excel spreadsheet with Activex dropdown (combobox) objects which help the user to know what options are available. I did this because the data validation list dropdowns are way too small in font size, and were gathering a lot of complaints. So my solution was to add combobox objects which allow the user to ...

Excel 2007 VBA FileSearch missing

Someting happened with FileSearch object in Excel 2007. In documentation it is said that FileSearch is hiden. Does it mean that there is no way to search for files using Excel VBA anymore? ...

Excel: Populate worksheet with matching rows

I have an excel workbook that is used to track tasks by project. Each project has its own worksheet in the workbook. Within each worksheet, there are rows for each work item, and the first column contains the person's name that the work item is assigned to. These rows are not sorted by name. I want to create a worksheet that will aut...

is there other faster way of doing this...

below code does the following: it takes a range, then finds distinct values in a range, and stores them in a d_distinct array, also for every distinct value it creates the distinct color, then using the Excel.FormatCondition it colors the range... (my current range is A1:HM232) for (int t = 0; t < d_distinct.Length; t++ ) { ...

Excel dates formatted in "YYYY MMM DD 00:00:00.000" need the dates to be in DD-MMM-YYYY

Is there a way to program a macro to convert all dates in a worksheet to go from "2009 APR 01 00:00:00.000" to a date format "dd-mmm-yyyy"? I have a data set that is regularly pulled and all the dates in 40+ columns are basically useless in 2009 APR 01 00:00:00.000, any ideas on how to create this type of macro and be able to share with ...

Excel 2003/VBA: How do I know if an object is already referenced?

In some VBA attached to an Excel 2003 spreadsheet I need to make use of some objects that take a while to instantiate - so I only want to do the 'set' thing once... It's easier the show the code than to write an explanation! ' Declare the expensive object as global to this sheet Dim myObj As SomeBigExpensiveObject Private Sub CommandB...

How to get/set unique id for cell in Excel via VBA

I want to have/define a unique id for each data row in my Excel data sheet - such that I can use it when passing the data onwards and it stays the same when rows are added/deleted above it. My thoughts are to use the ID attribute of Range (msdn link) So, I have a user defined function (UDF) which I place in each row that gets/sets the ...

How to fill up a range in Excel worksheet with an array formula using VBA?

Actually the input range is bigger than the actual range required for the array formula as well. So it would be nice if the answer also includes the code to resize the range before filling in with array formula. ...

how to switch off R1C1 reference style in Excel 2007

hi, i'm using excel-2007. i wanted to see smth with R1C1, then i checked the "R1C1 Reference Style" (office button->Excel Options->Formulas->R1C1 Reference Style)... Now i wanted to move again back to xlA1 style, i unchecked the R1C1 Reference Style, but my macros are still written in the R1C1 style... how can i switch to xlA1 reference...

Can't apply 3d properties to autoshape

The workbook I am working on in Excel uses graphics with 3d properties which are set in VBA. I just changed an image in the workbook, and now Excel complains that it can't execute any of the following lines of code: Selection.ShapeRange.ThreeD.Depth = fsdoord Selection.ShapeRange.ThreeD.ExtrusionColor.RGB = carcol Selection.ShapeRange....

Is there a way to crack the password on an Excel VBA Project?

I've been asked to update some Excel 2003 macros, but the VBA projects are password protected, and it seems there's a lack of documentation... no-one knows the passwords. Is there a way of removing or cracking the password on a VBA project? ...

excel numberformat...

i am using excel 2007... i have the following ranges... D E G H 5 1 2 1 1 6 2 2 1 1 now i select the range F8:G9 and write the following formula "=D5:E6*0.2+G5:H6*0.3" and press the CTRL+SHIFT+ENTER... i.e. doing matrix addition,... now i have the following result F G 8 0.5...