Tag: excel-vba

Copy highlighted cell and sheet name to destination worksheet

I am trying to copy cell values that meet two conditions: (1) highlighted row, and (2) have a particular region code, e.g. “WA”. Need to copy cell values from column B to the destination worksheet below the header in column A. In addition, copy the sheet name that corresponds to those values that meet those […]

Excel Macro that embeds images is having trouble looping

An AMAZING user helped me to embed images vs. inserting images, so that when users use the macro to insert images and then send the workbook to others, the images would show. Link to the question I edited it to work for me and it for the most part, worked like a dream! But now […]

Disable Application.OnKey behaviour Excel 2013

I am using Application.OnKey in Excel 2013 to change the behavior of a specific row, when the keys c, x, and z are pressed. My code is below: In a module: Public Sub SetOnKey() Application.OnKey “x”, “Macro1” Application.OnKey “c”, “Macro2” Application.OnKey “z”, “Macro3” End Sub Public Sub UnsetOnKey() Application.OnKey “x” Application.OnKey “c” Application.OnKey “z” End […]

Excel VBA Code for Multiple Rows

I have got VBA for Appending HTML Tag. I want that code work for multiple Rows like J2:J50000 Code is like Option Explicit Sub main() Dim newStrng As String Dim word As Variant Dim parTag As String, endParTag As String Dim dateCounter As Long parTag = “<p>” ‘ endParTag = “</p>” ‘ With Worksheets(“TextSheet”) ‘ […]

VBA Sharepoint download not the canonical revision

In my excel workbook I use a VBA script that calls URLDownloadToFile to download a different excel file stored in sharePoint to the current folder of the workbook. My problem is that the downloaded workbook is not the latest / canonical revision. The link I’ve used as a parameter for URLDownloadToFile is the one that […]

VBA – Graceful ways of calling function that doesn't return anything

VBA: Can someone list graceful ways of calling a function that doesn’t return values? public function myDoSomeTasksFunc() myForm.Banner.Caption = “Make sure to select settings before you begin..” NumTimesFuncIsCalled = NumTimesFuncIsCalled + 1 myTotalU = 0 maxRows = 5 mpForm.pgMain.Enabled = False myForm.cbProcess.Enabled = False End Function When I call the function dim myErr = myDoSomeTasksFunc() […]

How to protect a sheet using VBA, whilst allowing the group/ungroup functionality to work?

I am using the following code to protect all the worksheets in a workbook: Sub protect_all_sheets() top: pass = InputBox(“Please input password to protect all sheets:”) repass = InputBox(“Please verify password”) If Not (pass = repass) Then MsgBox “Error: Passwords do not match” GoTo top End If optimize_vba True For i = 1 To Worksheets.Count […]

Complex shading between multiple lines on graph

All, I would like to create different colour shading between two lines and the shading colour dependant on whether the point is above “Baseline” or not. Current Graph below; For instance I have shaded in (on paint) how I would like the end result to look for either case; If anyone can let me know […]

uniqueness of active sheet VBA EXCEL

I have a question, I am having in one basic sheet, rows, for each row I create new sheet, each new sheet has in cell A3 value that I would like to use as a name for my new active sheet. Here the problem starts, as in excel the name of the sheet can only […]

Filter excel data by most recent date

I have a list of IDs, dates and scores and I need to get the score corresponding to the latest date. The data looks like this: ID | Date | Score ___________________________ 123 | 03/15/2016 | 10 123 | 08/10/2016 | 4 456 | 09/01/2016 | 7 456 | 02/02/2016 | 10 678 | 07/01/2016 […]

MS Excel Spreadsheet is the best Office Software, Excel VBA and Excel Formulas make Spreadsheet work faster.