excel-vba

Copy and Paste every Nth Row - Macro

I need a macro that will copy a column from one worksheet and paste into another spreadsheet on every 5th row. I've tried using snippets of code, but I haven't found one that I can modify to make this work. Driving me crazy. I'm sure this is pretty easy for those who are more advanced with VB code. Anyone willing to help me out would ...

Display milliseconds in Excel

I am trying to display milliseconds in an Excel macro. I have a column of integers which are simply timestamps in milliseconds (e.g. 28095200 is 7:48:15.200 am), and I want to make a new column next to it which keeps a running average and displays the time in a "hh:mm:ss.000" format. I have tried multiple different routes, but I simply...

How can I get the text to show in a row over 409 pts high?

My task is to get text to print and display though it is longer than the 409 point row show. The sheet I'm working on is a Destination sheet from a Source sheet that can change often, but generally only 1 of 15 cells present this problem. Cell parameters are fixed so I can't change font or column width. On a spreadsheet I've made a Ma...

Forcing Inf And Nan To 0 Vb.net Excel Interop

I am creating a report in my asp.net application. The report outputs to excel using the excel interop. Some calculations in the report cause excel to display "Inf" or "NaN" I want to force these calculations to zero so that the report displays zero and NOT "Inf" or "NaN" ...

Formatting - add comma, 2 decimal places to cell values vb.net excel interop

Does anyone have any vb.net or vba code that will format excel values or a range of cells to have comma for 100s, 1000s,10000s etc.. and 2 decimal places only. i.e. 10,256.45 ...

Excel Macro to Generate SQL From Sparsely Populated Sheet?

I have a worksheet that has been sparsely populated with data that needs to go into several relational database tables. The sheet looks like this: A B C D E F G Table_1 Table_2 Table_2 Table_3 Table_3 Table_3 Table_3 Table_3 Table_3 Table_3 Table_3 Ta...

How do I create a VBA macro that will graph a changing range?

Hello, Currently, I have a table that will automatically update when new data is added to a spreadsheet. I am able to easily create a macro that will graph a set range, but how do I get it to automatically update the range so that it graphs all the right data? My goal is to be able to create a button that I can press at any time that wi...

Why doesn't this for loop process the full data set?

Background I have a spreadsheet of ticket allocations for an event. On each row of the spreadsheet is a name and the number of tickets allocated. I need to change the spreadsheet so that each name is duplicated once per ticket on separate rows, like this: I have a macro to do this, however it exhibits strange behaviour The Proble...

filter excel worksheet based on records form a 2nd sheet

I have an excel file that is a SEO report of a website. But the tool that generated the report included everything under the sun and most of it is junk. I want to filter out the important info such that I keep only records in the first worksheet that correspond to a record in a second worksheet. Basically I want to keep all the records ...

VBA/excel to dll/exe for Java

Hi, I have an excel file with mannually input functions, which use an add-in from a third party. I want to use functionalities of the excel file in Java. I could think of two ways of doing it. code the functions in VBA, or VB with excel reference, then generate .dll or .exe files for Java to use. Feed data to excel file using jxl (wou...

Is sharepoint versioning stored inside the document for excel documents?

Does anyone know if SharePoint stores it's version numbers inside the files for Excel files? I would assume that it does not. This is what I need: I have an Excel file stored in a SharePoint document library. The file will eventually be distributed and must be able to function offline. The file is somewhat macro-intense, and I would...

VBA lookup data in seperate document and different columns according to specific criteria!

Hello, Please could anyone help? Attached please find the example. The sheet (in document 2) is seperated into 3 parts: part 1: The second column has codes starts with MLR (yellow background) -> look up data on document 1 ( column 4 & 5). part 2: The second column has codes starts with SP (yellow background)-> look up data on docum...

How to stop a Macro either if it has been run already or if a there is a value in a particular cell

I'm using Auto_Open on a Excel Template (.xlt) to run a macro which imports some data to a sperate sheet, adds some forula and then creates a number of pivot tables and charts. The result of which is a finalised report which can then be saved as .xls. I have added the following IF statement to the top of the Auto_Open sub to check cell...

list of VBA OOP Concepts

Hi All, I am building some material for OOP (object oriented programming) in VBA, so can anybody list me the OOP concepts which are available in VBA? for example from my reading I discovered that: inheritance is not available in VBA !!! encapsulation concept is there as you can use access modifier "private" and build a public propert...

Need Help Inserting Double or Single Quotes

Hi everyone, I have a long list of names that I need to have quotes around (it can be double or single quotes) and I have about 8,000 of them. I have them in Excel without any quotes and I can copy all of the names and paste them no problem but there are still no quotes. I have looked and looked for an Excel formula to add quotes to the ...

Link to another workbook using conditional formatting in Excel

How can i use conditional formatting to extract data from other workbook? I tried: =IF(LEFT(B26,3)="SSS",VLOOKUP(B26,'XXX.xls!$A$4:$E$119,4,FALSE)) But I get this error message: You may not link to other workbook via conditional formatting What can I do with this situation? People out there mentioned "define name" but I'm not...

Excel VBA ListRows.Add Fails

I'm probably missing something simple, but ListRows.Add is giving me grief. Here's the function: Sub addEmployee(employeeName As String, tableToAddTo As ListObject) Dim newRow As ListRow Set newRow = tableToAddTo.ListRows.Add() newRow.Range.Cells(1, 1).Value = employeeName tableToAddTo.Sort.Apply End Sub In most cases, t...

Implementing my own interface in vba always raise this error !!!

how to Implements my class 'ClsInterface' which have this code Public Function add(x As Integer, y As Integer) As Integer End Function in my class 'Class2' which have this code Implements ClsInterface Public Function add(x As Integer, y As Integer) As Integer add = x + y End Function my test code is Public Sub test() Dim obj As N...

compre sheet 2 sheet and copy 2sheet into one sheet merge and sort data

...

pivot table in userForm in excel vba

Dear All, Any idea about how to embed/insert pivotTable/pivotChart in a userForm? *code sample will be great to share. 1000,000 thanks in advance ...