excel-vba

excel macro to select multiple row

I have excel macro to select a row to cut and paste to next sheet. Now I want to select multiple row at one time to cut and paste to next sheet, then go back to previous sheet to delete the blank rows that were cut. The code I have for the single row cut and paste is follows: Sub CutPasteRows() Dim iLastRow As Integer 'select the ...

Julian Date to mm/dd/yy in excel

I am trying to convert a julian date (yy/ddd) to a regualr mm/dd/yy data in excel vba. I have an idea of using a select case statement that calls a function for each month. But that is alot of code and I am lazy. I am wondering if there is a better way? ...

How to reference logo image multiple times in Excel 2007

Got a company logo need to use on several worksheets. How can I use and reference just one instance of the image to keep file size down, or does it matter? ...

How to concatenate strings in Excel

This question comes from a comment to Range.Formula= in VBA throws a strange error. I wrote that program by trial-and-error method so I naturally tried + to concatenate strings. But is & rather than + more correct method for concatenating strings? ...

Excel VBA merge multiple columns into one on separate rows

Hi there! I have an excel 2007 worksheet open with 5 colums and +/-5000 rows of data. What I want to do is create a macro that will: insert 3 blank rows under each record copy the value in that row on column 1 and paste it in the 3 new rows in column 1 CUT the value from column 3 and place it in the first blank row beneath it in colu...

VBA - Calling a function which accepts parent object as variable

Is it possible to create a function which accepts it's parent object as a variable? I suppose the simplest way to illustrate what I'm talking about is to provide an example: Module 1 Code: Function IsProduct() as Boolean IsProduct = (vartype(Parent.Value) <> vbEmpty) End Function ' "Parent" in this case would be a Range ' Module...

Show a form on all worksheets in an Excel file

I am writing a little generator script (using Excel VBA) to generate a bunch of source code, given various input from users. Currently I have one 'generator control' worksheet that provides access to the generation scripting tools. Here there is a button that pops up a little form with various generation options. Each portion of sourc...

Next non-blank cell in excel/visualBasic

I'm trying to script a very basic set of keystrokes in excel where I'm setting a cell to reference a cell that is 2 to the right and then the next non-blank cell down. Very easy set of keystrokes: = right right ctrl-down enter But when I use the macro recorder to do this it wants to substitute the ctrl-down with a relative referen...

How do I assign a value to a property where the property name is supplied at runtime in VBA?

I'm trying to create a worksheet that creates a list of values that will be used to initialize the values of an instantiated class. For example, I might have the following in my initialization worksheet: Property Name Value StartingCol A StartingRow 11 I'd then create a class that would pars...

How can I evaluate a string into an object in VBA?

In my previous question, How do I assign a value to a property where the property name is supplied at runtime in VBA?, I learned to use CallByName to set a property in a class at run time. This time, however, I'm trying to figure out how to get an object at run time from a string. For example, let's say I have a string with the followi...

Architecture Q - VBA Excel Macro or VS Tools For Office?

Hello, I have requirements from our client where we basically have to 'parse' PDF files from various different sources. The solution we have come with, as 'phase 1' (as we have short time to market and will save them a huge amount of time) is 1) manually use Able2Extract application to pull out the columns you need from the PDF file, ...

Is there much overhead involved in VBA classes?

Hello, Is there much overhead involved in VBA classes? I noticed that on a previous workbooks I effectively did the same thing as what's currently in my classes, but it ran faster. ...

Excel COM Add-In dialog interrupts script

Hi all! I have written an Excel COM Add-In in C++ for automation of Excel with VBA. It contains an own dialog showing some general informations about the Add-In. Now i create a button in Excel that opens the dialog. Leaving the dialog with the escape key leads to an Excel message that the script is being interrupted instead of just clos...

vba in excel 2003

Hi again:) I'm trying to understand this code, and I still don't know why it starts with 2 on the cell A1, shouldn't it start with 1? Private Sub CommandButton1_Click() Dim i, j As Integer For i = 1 To 10 For j = 1 To 5 Cells(i, j).Value = i + j Next j Next i End Sub because on my other example I have this and it starts with 1 in A1...

prime number in vba excel 2003

Hi I'm analyzing a code from the website and I tried it on my side as well but seems it doesn't work. Could you please tell me why? would greatly appreciate your help. Thanks Private Sub CommandButton1_Click() Dim N, D As Single Dim tag As String N = Cells(2, 2) Select Case N Case Is < 2 MsgBox "It is not ...

Form wont stay on top. How do I keep my excel form from hiding behind other windows after I browse for file?

I have a vb.net program that opens up an excel workbook and runs a macro ("Report") in that workbook when a button is clicked. //Workbook with macro and form xlWorkbook = xlApp.Workbooks.Open("W:Data\Excel Program.xls") //Macro: xlApp.Run("Report") //Macro opens form from workbook. I browse for my two .csv files //and the...

How to copy required rows of data from one excel sheet to another based on a condition?

hi, I have an excel sheet of some 7k rows of data, I need to segregate that data into three different sheets based on a column( group name). So , I need to segregate the data based on the group name (there are 3 groups) into three different sheets. Please let me know regarding this... Thanks in advance... Kar ...

Forcing Garbage Collection in VBA/Excel 2000

Is there a way to force garbage collection in VBA/Excel 2000? This question refers to the Macro language in Excel. Not using VB .NET to manipulate Excel. So GC.collect() won't work ...

How do I convert multiple columns to a single column?

I have a table that looks like this: Col1 Col2 Col3 Col4 a b c d e f g h I need to convert it to this: Col1 New a b a c a d e f e g e h I have a ton of data and doing this by hand is out of the question. Does anyone know of a fast way to do this? I'm hoping that there is a built in way (such as...

How do you use the value of a named cell in a macro in a diferent sheet, same workbook?

I'm just not getting it, I'm using Excel 2003 and am totally confused as I'm jsut not getting it ...can anyone help? I need to check that named value with a number of coulumn headings on the active sheet and then insert a colum to the left of the column holding the matching text. I'm sure that bit is very hard - but I'm not even able t...