EXCEL-VBA (Visual Basic for Applications for MS-Excel) is the dominant programming language for Microsoft Office Excel.

learn more… | top users | synonyms

0
votes
0answers
6 views

Moving ActiveX button code from a sheet to a module leaves the button useless. Need help to fix it

My VBA code that copy/pastes different cells within the same sheet, so I created an ActiveX button and pasted my code in the button's, which was automatically created in the sheet where my button is. ...
0
votes
0answers
9 views

“Out of Range” error using record function to sort on Excel

I have a bit of experience programming but I have absolutely none with VBA. I have been using the record macro function in Excel with success, but I run into problems when I try to do a sort. All I do ...
1
vote
1answer
16 views

Disable all dialog boxes in Excel while running VB script?

I have some code in VB that saves all XLSM files as XLSX. I already have the code that will do that for me, but dialog boxes show up for every action. This was fine for a few dozen files. However, I'm ...
0
votes
1answer
21 views

Using a tree data structure in VBA

I am getting more familiar with VBA and I am attempting to do a machine learning program for Tic Tac Toe. I don't want to just hard code the possibilities to win. The best I have come up with for a ...
0
votes
0answers
17 views

Calling an existing worksheet with vba by using its code name in excel

I am trying to set the formula of a cell to an if formula that uses data from an already existing sheet within the workbook. However whenever trying to reference the sheet i get a file dialog box ...
-1
votes
3answers
14 views

How would I put VBA process into a loop?

Edit: I figured it out, thanks to a helpful post. My final code is below. I am using Excel, and I've got this VBA script that looks for a string, copies it, then pastes it two cells down. What I'd ...
0
votes
0answers
9 views

Monthview Bolding Every Value

I created a Monthview and TimePicker in a form. I want the user to pick the time, and select a month which will bold the value selected each time, then select OK which will insert the value. I have ...
0
votes
4answers
26 views

Looping through cells, building a range in VBA

I am looking to loop through cells and build a range for a graph. My main issue is that I cannot figure out how to incorporate the 'i' into the range. Example: Dim name As String Dim newChart as ...
0
votes
2answers
7 views

VBA - selecting a folder and referencing it as the path for a separate code

I'm able to use this code to select a folder: Sub ChooseFolder() Dim fldr As FileDialog Dim sItem As String Set fldr = Application.FileDialog(msoFileDialogFolderPicker) With fldr .Title = ...
0
votes
2answers
24 views

VBA Excel: Function to output next quarter from input date

I'm working in vba for excel and need the use of a function that I can input a date that is in the format of the excel converted date (such as 40736). And output the date of the quarter immediately ...
0
votes
4answers
30 views

VBA Summing a Column of Variable Length

Another VBA question (I'm on fire lately) As the title says, I am trying to sum a column that can can be of a variable length and then stick that sum in cell F3, but I am running into a an ...
0
votes
1answer
25 views

Trying to make a code with VBA for excel

Trying to make a code for a spreadsheet I'm working on, I do not have prior experience and found an example online. The first part of the code works fine, but when I try to bring in the second "if ...
0
votes
2answers
28 views

If cell contains partial string, then change cell value

I have a list of hundreds of companies in a column. There are repeat companies that were inputted differently. (i.e. "Nike" vs "Nike Inc") I am trying to program a macro in excel to loop through the ...
0
votes
1answer
31 views

VBA Excel: Using SaveAs Dialog for Text Files/Custom File Types

I have an Excel macro which writes a specific string to a text file. The catch is, I need to save it as a custom file (".us1"). I'm attaching my current code below. I ended up doing a weird reversal ...
0
votes
2answers
36 views

Generating permutations in VBA

This question has been asked before, but I can't find an answer that is easily applicable to Excel VBA. Basically I want to do exactly what this poster has asked, but in VBA. I want to create an ...
0
votes
2answers
20 views

VBA Find function not picking up the correct value

I'm trying to use the find function in VBA, but it's giving me an issue. If the value that I'm searching for is 3, it will pick up other cells that have 3's in them like 33 or 333. How do I get the ...
0
votes
0answers
14 views

Excel VBA: Import worksheets from workbooks into another workbook while performing operations

Goal: I want to import a worksheet from workbook1 to workbook3, but before that I want to make an addition to the importing sheet from workbook1. The addition is equal to one colum with calculations ...
0
votes
0answers
19 views

Passing params back and forth between excel vba and c#

I'm trying to use C# with excel and vba. I wrote with VS Express a library dll and everything went well as long I used only unique cells in Excel as one or many parameters. Then I tried something else ...
0
votes
1answer
32 views

Excel VBA Split() with a whole word as delimiter

I want to split an XML Code after an command i.e. ....<car>BMW3</car> There is a lot of stuff in front of this command so I would like to use the Splitfunction with "<car>" as ...
1
vote
1answer
32 views

Update Worksheet by comparing it to another Worksheet

I have an excel Worksheet ("Sheet1") that I need to compare with another Worksheet ("Sheet2"). Both Worksheets are formatted exactly alike. (ie columns are the same, with the same headers) When ...
0
votes
1answer
13 views

Looking for an Excel VBA solution to swap cell values between columns when a specific value is present

SO won't let me post an image of my problem, please see here: http://i.imgur.com/PaZ6Dpt.png The picture shows what I'm trying to do. I need a VBA script that looks in column H for "Service Desk" and ...
0
votes
0answers
31 views

VBA assigning cell value from array

I have an excel report that relies on 3 source documents for data. The report pulls and compiles the 3 sources into 1 array. It then loops through the array and assigns the values to the columns of ...
0
votes
1answer
14 views

Copy and paste automatically on cell change using private sub

I am trying to add an archive sheet to my workbook where closed tickets are collected. I would like the row of a particular ticket to be cut from a sheet labeled 'Tickets' and pasted into a sheet ...
0
votes
1answer
16 views

Trying to combine macros together in excel to create one big one that does them all

I essentially have a bunch of macro buttons that fill down my formulas to a determined amount of rows by looking at another spreadsheet and seeing where the data stops: Range("A4:A" & ...
0
votes
1answer
18 views

Subscript error when trying to remove blank values from an array in VBA

I am trying to run a Simple formula to remove blank entries from an array. The array I am using is loaded from a field in a data table I have set up in excel called TY. The name of this field is TY[L3 ...
0
votes
1answer
16 views

Loop code keeps copying from the same excel spreadsheet in a folder

So I was trying to create a list of excel files in a folder (file name and path) and then use a For loop to copy and paste a specified worksheet for all of the files listed into a specified worksheet ...
0
votes
1answer
15 views

Preserve Variant type when copying to Range

Reduced to its bare essentials, this is my code: Public Sub test_sub() Dim myVar As Variant myVar = "1/1" Range("A1") = myVar End Sub My problem is that my string "1/1" is being rendered in ...
2
votes
1answer
30 views

Divide the value of non-blank cells (in a column) amongst empty cells and repeat with vba

I start with a sheet like this: colB: row1: 15 row2: (empty) row3: (empty) row4: 60 row5: (empty) row6: 45 row7: 88 row8: (empty) row9: 10 ... rowN: 56 I want to divide the value of non-empty ...
0
votes
2answers
25 views

Excel changes dates where the day is lower than the month (e.g 2nd april) to the reverse (e.g 4th feb)

I am having some toruble with excel and dates. The situation is as follows: We have a monthly report with a number of tabs which the macro imports into a central spreadsheet, it has about 120 columns. ...
0
votes
1answer
9 views

npoi SetCellFormula custom formula in VBA

I have an application that fills with data an excel template .Template is .xlsm .In template I created vba function called SumByColor when i try to set a cell formula to this function i get this error ...
0
votes
0answers
27 views

Is it possible to get Excel Range.Validation.Value for multiple cells without having to loop over all the cells?

I've written a program in c# that performs many different validation tests on a large Excel spreadsheet. One of the tests is to determine if any cells fail the built-in validation functionality ...
0
votes
0answers
8 views

Adding a new workbook from a csv template

In a VBA macro I need to add a new workbook using a template. When I use an xlsx the new workbook has the name of the template without the xlsx extension. When I use a csv as template, the new ...
0
votes
1answer
18 views

How can I make the standard deviation appear in the status bar?

Using Excel 2010, I want to be able to see the (population) standard deviation of the cells I select, in the status bar. I know you can alter the status bar, but I have no VB knowledge whatsoever, so ...
-4
votes
0answers
38 views

How to sort sort the rows of a multidimensional array without using a sheet

I have the following array: Dim pop(3, 9) As Double pop(1, 1) = 3 pop(1, 2) = 2 pop(1, 3) = 1 pop(1, 4) = 4 pop(1, 5) = 2 pop(1, 6) = 5.16 pop(1, 7) = 1 pop(1, 8) = 1 pop(1, 9) = 5.16 pop(2, 1) = 2 ...
0
votes
0answers
13 views

Open accdb file in new excel with excel vba

My problem is the following. I have got an acccess database which runs a few queries which already works perfectly. My problem now is that I want to open it up in Excel but only a specific table not ...
0
votes
1answer
33 views

VBA replace multiple strings from a separate list

I need to replace STRINGS but so far I managed to replace words only. The code is going through Description column and is supposed to replace every sequence from the list. The idea is to use ...
0
votes
0answers
17 views

Something seems to make my program resets at the end of button action

I have created a simple button that calls another procedure. Everything runs fine but when the code gets back to the Sub Button1, at "End Sub" line, the message "This action will reset your ...
0
votes
1answer
23 views

cannot select another workbook when macro enabled workbook open

I have a macro enabled workbook that uses code to set a timer - this is a shared book and often people will be in the book and leave their desk etc. It is set to save & close after 30 minutes of ...
0
votes
1answer
30 views

Run-time error '-2147418113 (8000ffff)': Automation Error

My code is running perfectly until get to "If c = "" Then". At this point the run time error '-2147418113 (8000ffff)': Automation Error is raised. I have put an On Error Resume Next statement to ...
0
votes
1answer
28 views

Excel 2010 Write String to Cell [duplicate]

I would give a full description but everything relevant has already been said in this question from two years ago that went completely unresolved: Writing a string to a cell in excel My program is ...
0
votes
0answers
37 views

Excel - Export data

Let's say I have an Excel file (bunch of sheets and macros used in most of those sheets). I have one sheet where I am connecting to SQL Server to pull live data. I am saving the Excel and connection ...
2
votes
5answers
57 views

Find rows repeated in no particular order and show result sorted by number of repetitions

I've been trying to solve this problem in Excel for a while but I'm totally lost. I was able to solve the problem by using Python but I would need to implement the solution in Excel itself as well so ...
0
votes
1answer
25 views

VBA macro to move cells to a new sheet Excel based on cell content

I look around and could not find the specific response I need. So I will ask. I have a sheet (sheet1) with data only on column A. It looks like this: And I need to create a VBA macro that searches ...
-2
votes
2answers
43 views

Removing characters with .Replace in VBA for Excell

The following function was given to me via an answer that I asked earlier today. What I'm trying to do is to remove a character from a string in Excel using VBA. However, whenever the function runs, ...
0
votes
0answers
21 views

Is it possible to assign Permissions to a worksheet by User or Station?

Not sure if this is even possible... I know how to protect the entire sheet with VBA code but striking out otherwise. I've tried to implement the Excel "Allow Users to Edit Ranges" but will not work ...
-1
votes
2answers
30 views

Converting lengthy Excel function to SQL?

IFERROR((SUMIFS('Sheet 1'!$K:$K,'Sheet 1'!$A:$A,'Sheet 2'!I$5,'Sheet 1'!$C:$C,'Sheet 2'!$B15,'Sheet 1'!$K:$K,"<>0"))/(SUMIFS('Sheet 1'!$J:$J,'Sheet 1'!$A:$A,'Sheet 2'!I$5,'Sheet 1'!$C:$C,'Sheet ...
0
votes
0answers
21 views

ScreenUpdating = False not working

I know there are lots of threads relating to this topic, like don't use "Select" or "Activate" or set it to false if you need to use it. I set it to False every time I use "select" or "activate", but ...
0
votes
1answer
24 views

Select dynamic range without header

I want to select all rows in the range A2:BG2 if there are data present in column B. Row 2 is a header. This almost works: Set rng = Range("A2:BG2").Resize(Cells(Rows.Count, "B").End(xlUp).Row) ...
0
votes
1answer
17 views

VBA - How do I send new line command (\n) or tab command (\t) to a textbox.textrange.text of a PowerPointS Shape

SlideNumber = 1 Set oPPTSlide = oPPTFile.Slides(SlideNumber) For y = 1 To oPPTSlide.Shapes.Count MsgBox oPPTSlide.Shapes(y).Name Next With oPPTSlide.Shapes("Title 1") ...
-1
votes
0answers
40 views

How to return a double from a vba excel function?

Function test() As Double If ThisWorkbook.Worksheets("A").Range(type) = "1" Then test= 26# ElseIf ThisWorkbook.Worksheets("A").Range(type) = "2" Then test= 78# End If End ...