How to automatically apply the file path from a cell in VBA?

Now I am using this code for running a Excel Chart Template on bar charts: Apply Saved Chart Template ActiveChart.ApplyChartTemplate ( _ "C:\Users\Bosco\AppData\Roaming\Microsoft\Templates\Charts\Bar Chart.crtx" _ ) Since this link will be decid

How to save all hard-coded values ​​in a class

I have created a class in VBA which I would like to have some pre-set values associated with it. I am new to classes, and am wondering what is the best (/a good) way of structuring my VBA code within the class object, so that I can access these defau

VBA code does not always save in the office

I have a piece of code in most cases will save to the desktop, but sometimes when I am connected to the network, it will save into a network folder. I am keen for this to always save it in my desktop in all cases. Sub Svas() Dim Name As String FilePa

MS ACCESS VBA as a user to register as a path

By default the following code sends the exported file to My Documents: Public Sub cmdExport_Click() Application.ExportXML ObjectType:=acExportQuery, _ DataSource:="export1", DataTarget:="whatever.xml" End Sub Is it possible to ask the

unable to reset the used range

I was trying to add an automatic macro to my very large workbook to at least trim some fat off by resetting the used range. I've tried numerous codes and cannot get it to work and can't figure out why. (It seemed to work a few time when I would manua

How to call a subset of subroutines with a loop in VBA?

I have a series of subroutines (Sub1, Sub2, Sub3, etc). I want to call a subset of these subroutines based on user defined values. For example, subs 7 through 13. I thought of using a loop based on the number in the name of subroutine, but it does no

Conditional deletion in VBA

I am trying to piece together code to make my macro work correctly. This approach has served me well in the past but I cannot seem to adapt any code correctly. I found the following Sub way() Dim Cell As Range For Each Cell In Range("A1").Curren

Find recurring number combinations in the number column

I have searched and found discussions and solutions to similar problems, but not quite or as complex as I'm trying to figure out. I have an access table which consists of two columns Draw Number and Number Drawn as shown below. Draw Number is repeate

VBA INDEX-MATCH loop with Sub or Function error not defined

I have a looping INDEX-MATCH VBA that I am trying to debug, as it is constantly throwing a Sub or Function not defined error. With what I have already found on this site, I was able to check my references, but I still seem to be missing something ("S

Adding cell values ​​to the cell's indirect location

I'm trying to generate a function with VBA that automatically adds Values from one cell of a defined range of an Excel Sheet to the cell on it's right, so that for example when you put a number in A1 that number will automatically be added to the val

the day and the month are reversed

I have a cell with the following content : 01/02/2015 The cell is date formated Then I copy the value and put it in my module class : Set Line = New CTravelLine Line.Date= Cells(1, 8).value Everything works fine until the moment I put this value in a

VBA - Get the OLD value of Combobox

I would like to get the old value of a ComboBox when the combobox value will change. I have tried something like: Private Sub ComboBox1_Change() Application.EnableEvents = False newVal = ComboBox1.Value Application.Undo oldVal = ComboBox1.Valu End Su

vba macro: What is the table where my cursor is?

Writing a macro I found out that I need to skip the table contents and place my cursor right after that, for this I am using a code as Selection.Tables(cnt).Select Selection.Collapse WdCollapseDirection.wdCollapseEnd Here, cnt is a counter value whic

Copy a table reference in VBA

Is there any way to copy an array reference in VBA (or VB6)? In VBA, arrays are value types. Assigning one array variable to another copies the entire array. I want to get two array variables to point to the same array. Is there any way to accomplish

Macro with countive excluding other values

I have a macro which helps me to do the countif function between 2 data sets and see if all data specified as "Ours" was included in the data set specified as "theirs". This macro works fine for other data comparisons. However, I would

VBA: Obtaining Line Data When a Cell Is a Specific Value

I'm fairly new to VBA - most of my programming is done in PHP - and I haven't touched anything VB-like since VB5. I've been asked to learn VBA for work and am doing fairly well - but have gotten stuck. Our spreadsheet has 3 sheets (4, including the o

Word vba - How can I store string values ​​in a module?

the title may not be appropriate because I don't really know how I should put this. I have a template where I have a "Module1" module and a "ThisDocument" code. Module1 contains the following code to pick up values from the registry. I