2022 Developer Survey is open! Take survey.

Questions tagged [vba]

Visual Basic for Applications; a subset of Visual Basic used in all Microsoft Office applications. Consider using this tag together with the tag for the specific application in question. Good questions on VBA generally contain some code and asks for solution of specific issues. Questions asking for entire solutions (please give me the code / how to do this and this with VBA) are off topic and will be closed as too broad.

Filter by
Sorted by
Tagged with
-3 votes
0 answers
16 views

Convert Weekly Off into Absent Excel VBA

Would request you to help me providing excel VBA code which will replace weekly offs and holidays into absent in Sheet 1 if employee's attendance status is absent before and after weekly offs or ...
user avatar
0 votes
0 answers
13 views

Using data slicers and advanced filter for the same table in excel

I've got one table which I filter by some slicers. Although, I want to use also an advance filter on the already filtered table. I'm using a macro to start the advanced filtering, which can be started ...
user avatar
0 votes
0 answers
13 views

How to return default after auto hide empty columns when filtering rows?

I followed the solution posted in Excel - any way to auto hide empty columns when filtering rows? which works but it doesn't return to default when I clear the filter. This means that I will have to ...
user avatar
-1 votes
0 answers
42 views

Regarding M S Excel-VBA

I have an Excel workbook containing three worksheets. ITEM LIST Contains four columns - SR.NO, ITEM CODE, ITEM NAME and SALES PRICE. ITEM CODE and ITEM NAME should be locked (non-editable) ITEM ...
user avatar
0 votes
0 answers
25 views

How to unhide rows in an Excel spreadsheet depending on the contents of a separate cell using VBA

I'm working on a checklist for work, and I want to be able to unhide rows below a question based on if the answer to the question is yes or no. I.e. if it's yes, unhide these rows, if its no, keep ...
user avatar
0 votes
0 answers
15 views

I cannot seem to write to a newly opened document

Enclosed is an extract from a macro in Document startx.docx. The first part of the macro places some strings in the array sntc(1) to sntc(s). I now want to write these strings on to a new document, ...
user avatar
0 votes
0 answers
12 views

How to enable a specific data connection via VBA in Excel 2016

I'm building a worksheet that will automatically run a web query. Ideally, this will run automatically, without any user intervention. But sometimes the connection is blocked by Excel's security ...
user avatar
0 votes
1 answer
27 views

Excel VBA How do I set active cell to be only a cell with X data?

Dim NA As String NAFinder = 9 NA = ActiveSheet.Range("F9").Select For i = 0 To NARows NA = ActiveCell.Offset(i, 0).Value If NA = &...
user avatar
0 votes
1 answer
14 views

excel 365 macro that previously worked fine is now saving tabs as CSV with 9999 rows even if the rows are empty, why would it do that?

update: I also just tried to do a plain old 'save as' on my tab manually and that also results in the comma rows appearing up to 9999. When the spreadsheet is open I see no data in the rows that end ...
user avatar
0 votes
1 answer
35 views

How can I determine the size of each worksheet in a .xlsb file?

Working on Windwos 10 Enterprise with Excel from Office 365 version 2204, I have a large .xlsb file (>14MB) and want to determine the size of the single worksheets in kB/MB, optimally saving this ...
user avatar
  • 153
0 votes
3 answers
22 views

Powerpoint slides (shapes) don't seem to inherit alternative text from master

I would like to replace an element in my powerpoint slides to have a sense of document property variables. I do have the macro in place, and it works. But I don't understand why slides created, and ...
user avatar
  • 117
2 votes
2 answers
78 views

Excel How to transform data from wide to long based on multiple columns

I am a student learning more advanced Excel and I was curious if Excel had some built in features to handle pivoting more complex data. Or would it need to be scripted from scratch? Say I have table ...
user avatar
0 votes
0 answers
19 views

Auto adjust cell values if one cell values changed

how to adjust values automatically if cell values A1 has changed means then the changed values has to adjusted with B2 values and the final cumulative values remains unchanged. Suppose i have list of ...
user avatar
0 votes
1 answer
15 views

I have a worksheet with multiple tab and i want to separate each tab that contains same text into a separate sheet

I have a worksheet with multiple tabs, can i get a VBA code that will separate each tab into multiple files I want to make A1 and A1 SCREEN as one file, then B1 and B1 SCREEN be on another file and ...
user avatar
0 votes
2 answers
29 views

Excel VBA change cell color if it's today's date

I am not very good at VBA and would not even call myself a "programmer." I'm trying to use Excel VBA to change the color of a cell yellow with black bold text if its value is today's date. ...
user avatar
0 votes
1 answer
23 views

Delete Specific Rows from Excel from a List of Row Numbers

I have a worksheet with 83,188 rows and 4 columns of data. I have another worksheet that has a list of row numbers (eg 18751, 9127, 696, and etc) that signify the rows I would like to delete from the ...
user avatar
0 votes
1 answer
37 views

Is there a formula in excel or VBA to count groups of values? For instance if I had a column with the an "X" in groups of 1, 2, 3 or 4

IF column B, 8 rows had xx xxx xx xxxx xx xxxx xx xxx. I need to find how many groups of two X, three x and four x. The result of the above would be xx = 4, xxx = 2 and 4 = 2. I've tried VBA but the ...
user avatar
0 votes
0 answers
28 views

Count number of strike-through lines

I have a cell having multiple lines of data. Some of these lines are strike-through. Now, I want to know that how many number of lines inside that cell are strike-through. So, how to do that through ...
user avatar
0 votes
0 answers
16 views

Service Desk sends 2 Updated workbooks daily- we need to copy to our internal Sheet without overriding our columns for Team Notes

We have our own internal Excel workbook, which has additional columns where the team makes notes. We don't want these to go away, that's why we have to manually copy the data from the 2 workbooks our ...
user avatar
1 vote
1 answer
50 views

Create a histogram in a cell based on condition

I need a histogram in a cell based on condition. Example: In: Input My Out: My Output Needed Out: Needed Output So, If I'm using conditional formatting and choosing histogram, I have no option to ...
user avatar
3 votes
0 answers
31 views

Word VBA: Automating bookmark generation for individually numbered paragraphs

1. Problem summary This is my first time writing VBA for Word. I have multiple documents; each one is larger than 100 pp., with a plaintext index according to paragraph number. I am writing a script ...
user avatar
1 vote
0 answers
23 views

Autofilter Multiple Criteria but with Starts With values instead of Strings

Here's the setup: I wrote a VBA macro that can be applied to a report that comes out of our database of all the items in the library. The macro looks at the report, filters the call number by a ...
user avatar
  • 33
1 vote
1 answer
28 views

How to append to formula if a condition is met in microsoft excel?

I have a bunch of formulas dotted about my excel tab that are of the form: =cell_1+0.0049>SUM(cell_2:cell_3) for example- =O10+0.0049>SUM(H10:N10) I want to find all instances of these cells and ...
user avatar
0 votes
0 answers
19 views

Mirror multiple cells - how to do this with multiple pairs

To mirror 2 cells on diff sheets this code works well for me but what if you want to do this to a range of cells like below? Sheet1 Private Sub Worksheet_Change(ByVal Target As Range) Dim r1 As ...
user avatar
0 votes
0 answers
15 views

Allowing the user to select the excel file from which to copy a worksheet into the already open worksheet

I have an invoicing workbook where I want to have a macro that prompts the user to select a transaction workbook. I want to then copy the selected file's single worksheet into the invoicing workbook. ...
user avatar
  • 1
0 votes
1 answer
23 views

trying to randomize 2 cells adding values to it randomly to every week of the month for every employee

New Bei - First line >is dates, second is days and the third is week number. This is how my data look like. it is a weekly off register wherein I need to add word "WO" randomly in only 2 ...
user avatar
0 votes
0 answers
26 views

How to prevent crashing my 64bit VBA application when opening a workbook containing 32bit VBA code

I am writing a VBA application to preprocess excel files that I receive periodically from a client. These files contain 32 bit VBA code (which I don't care about), and I am running Excel 64bit. When ...
user avatar
  • 1
1 vote
2 answers
27 views

FInd Replace value of a formula in excel but incremental and loop

Dim sht As Worksheet Dim fnd As Variant Dim rplc As Variant Dim p As Integer Dim q As Integer p = 3 q = p + 1 fnd = "$3" rplc = "$" & q For Each sht In ActiveWorkbook....
user avatar
0 votes
1 answer
43 views

Excel VBA save to CVS file

I have an excel file which has a macro which saves the file as a .CSV file. I have a program that calls on the CSV file but the program only recognizes the .CSV file if I open it manually and save it. ...
user avatar
0 votes
0 answers
26 views

Excel VBA - Code to Match Cell Value with MS Access Table Value

I have an Excel workbook that generates a list of parts, there is also a Access table that has a list of parts. Here is an example of the Excel workbook: here is an example of the Access Table: I ...
user avatar
1 vote
3 answers
274 views

In Excel, how do I access cells using fully-qualified numeric coordinates (worksheet, column, row)?

I have the indices of a cell in an Excel workbook: Worksheet, column, row (and yes, I know that Excel likes 1-based indices.) Given those, what formua should I write to obtain the value of that cell?
user avatar
  • 7,312
0 votes
1 answer
37 views

Using 'Sheet name' in Excel VBA instead of 'Tab name'

(How to use Sheet name instead of Tab name in Excel VBA)? How do I replace the tab's name ('Electrical') with the actual Sheet name (Sheet 11)? Whenever I do it doesn't work, here is the working code ...
user avatar
  • 1
0 votes
1 answer
22 views

Create latest update date excel

I want to insert a last updated on () if any value in that row was changed. I have a column for this in my spreadsheet. Applies only with actual values changed
user avatar
0 votes
1 answer
14 views

VBA Methods Replaced by Variable

I'm still a VBA novice, but I'm starting to get a better handle on things. Though I made the dumb mistake of declaring a variable that's the same as a method. I declared the variable: Dim cellS As ...
user avatar
  • 3
1 vote
1 answer
40 views

updating with modified date, not todays date

Im a total novice at VBA code, but from my googling it looks as if I’ll need VBA for what I’m looking for. I have a sheet where there is a “notes” cell, and a separate cell which contains the date of ...
user avatar
0 votes
1 answer
43 views

Find Closest Match (Conditional Lookup)

I am trying to do conditional lookup in Excel (MacOS). Let's say I have the table shown below, and I want to search for (type=alpha, length=165). In the table, there isn't an exact match so I'm trying ...
user avatar
  • 103
0 votes
1 answer
51 views

Removing date from datetime (VBA Excel)

I need to delete the date from mulitple rows with a datetime value. Or extract the time to another cell. For example: A1 = 3/11/2022 10:20:00 A1 after macro = 10:20:00 or A1 = 3/11/2022 10:20:00 A2 = ...
user avatar
  • 1
0 votes
0 answers
20 views

Excel VBA - Comparing Data Between Two Workbooks

I have two lists. ListOne has a bunch of parts and what stage the part is in. ListTwo has a few parts that tells us what stage the part can be delivered. I need code to check if the part in listOne is ...
user avatar
0 votes
1 answer
24 views

Max or Min of Consecutive Same Condition Match Excel or VBA

Max or Min For Consecutive Matching Condition Dear Folks, I am seeking help for the following roadblock in excel. I am looking for a solution to find max/min if the conditions match for consecutive ...
user avatar
0 votes
1 answer
27 views

Remove Macro References in .XLS Files

I have been playing around with how to remove Excel macros using PowerShell and COM objects and have had success in doing so, however, I noticed that for .XLS files, there is a reference to the name ...
user avatar
1 vote
1 answer
38 views

How to highlight cells in Excel that end in a numeric value

I work at a library and I'm given a report to create an Outdated Stock Report/Shelf Lists that rely on an item's Publication Date. Unfortunately, because of the nature of serial publications, the ...
user avatar
  • 33
0 votes
1 answer
29 views

Code returns a type mismatch when there is "If statement" used

I have a code Set wsDest = Workbooks.Open("G:\Manager Folder\Test\Leave Tracker Master.xlsx").Worksheets("Tracker") Set myrange1 = wsDest.Range("A:A") '...
user avatar
0 votes
1 answer
72 views

VBA Code to check if entry exists in a range for each date in a date range

I need VBA code to check if entry exists in a range for a value against each weekday in a date range If the value to be searched is in C4 and the date range is in B7 & B9 of workbook A, It should ...
user avatar
0 votes
1 answer
42 views

Macro to check date range against criteria

I need VBA code to check each weekday date in a date range against a table in another sheet, if the corresponding value is >9% for any of the days, it should return a msg box i.e, in the "...
user avatar
0 votes
0 answers
90 views

Having trouble with VBA adding page numbers plus text in Word Header

Nothing more humbling than a simple VBA problem that takes all night. I would like to add page numbers to the header of a multi-page document. I have set uo recto/verso pages and no header on primary ...
user avatar
0 votes
1 answer
67 views

Function returning #VALUE error in expecting integer in VBA

I want a function that loops through closed workbooks having some parameters given from cells of another workbook. The aim is to count the number of presence of people in some locations considering a ...
user avatar
0 votes
1 answer
31 views

Macro is not copying data validation in the cells

I have a macro to copy a selection from a sheet and email it as a separate attachment, however it is not copying the data validation that exists in those cells. In the sheet there is validation that ...
user avatar
0 votes
0 answers
71 views

Excel Drag and Drop - How to Undo Using VBA

I have an Excel sheet in which the user drags a cell in column A to any cell in column B. Each of the cells in column B has a random integer. If the user drags a cell in Column A to a cell in Column ...
user avatar
0 votes
1 answer
40 views

Extracting all matching (or close to) values between given START n-th and END n-th values / using Power Query

Consider having two tables. Table1(T1) has Date/Time and Pressure value columns and Table2(T2) has also Date/Time and Info values columns. T1 is showing pressure change through time, for instance: 21....
user avatar
  • 121
0 votes
1 answer
59 views

I need VBA code to select certain rows based on grouping data in one column and email that selection

I need to select rows based on email address and mail it to that address. I only have code that will send a worksheet to email The image is the sample file. The macro needs to select the rows based on ...
user avatar

1
2 3 4 5
70