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
0 votes
0 answers
277 views

VBA: Pivot filter based on value range

I am new with VBA and I would like to have a code to select a pivot filter based on a cell range. How can I change "CurrentPage" to be a range value ? Sub PrintTour() ActiveSheet....
Alex's user avatar
  • 1
0 votes
0 answers
224 views

How do I only enter information into visible cells with VBA?

I have written a VBA program that automatically filters rows based on user input. Then, the program prompts the user to input (Scan) part numbers one at a time until completion. Right now, it takes ...
WACK_Sage's user avatar
0 votes
1 answer
98 views

Why is this VBA data-fetching function hanging?

I have written this function in VBA to fetch data from a URL. I am calling it from another function that is called in an Access query. The code is adapted from code in an article cited in the comments ...
NewSites's user avatar
  • 766
0 votes
0 answers
71 views

Why is this VBA data-fetching function hanging in Access?

I have this function in VBA, which I have used successfully before in Excel to fetch data from a URL: '======================================================== Public Function sURLfetch(ByVal sURL As ...
NewSites's user avatar
  • 766
0 votes
0 answers
350 views

VBA code that changes zoom level based on text/object in sheet?

All, I've been looking for VBA code that achieves the following: Sets zoom to 80% for worksheets that contain a certain key word Sets zoom to 60% for worksheets that contain a picture Sets zoom to 85%...
EN_VBA's user avatar
  • 1
0 votes
1 answer
27 views

Formula won't calculate or increment

In the following code, my formula apply as text and won't calculate. Also, Autofill won't increment cell number. I also tried with ActiveCell.Value Dim RowCount As Variant Dim VRowStartNoMember As ...
JohnnyHG's user avatar
0 votes
0 answers
166 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 ...
user348514's user avatar
0 votes
1 answer
419 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 = &...
Guilherme's user avatar
0 votes
1 answer
59 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 ...
DevAroundTheClock's user avatar
0 votes
1 answer
1k 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 ...
MathProb's user avatar
  • 153
0 votes
3 answers
463 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 ...
MyICQ's user avatar
  • 242
2 votes
2 answers
2k 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 ...
Victor Feagins's user avatar
0 votes
0 answers
33 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 ...
user1092590's user avatar
0 votes
1 answer
21 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 ...
user1688884's user avatar
0 votes
2 answers
1k 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. ...
Rycliff's user avatar
0 votes
1 answer
2k 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 ...
user1091735's user avatar
0 votes
1 answer
363 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 ...
Al Velasquez's user avatar
0 votes
1 answer
524 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 ...
Pandey_Ji's user avatar
1 vote
1 answer
1k 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 ...
luibrain's user avatar
3 votes
0 answers
453 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 ...
Francis Regan's user avatar
1 vote
0 answers
271 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 ...
Jordan's user avatar
  • 37
1 vote
1 answer
258 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 ...
user9940344's user avatar
0 votes
0 answers
238 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. ...
kmk's user avatar
  • 1
0 votes
1 answer
29 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 ...
Ajit Kumar's user avatar
0 votes
0 answers
752 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 ...
jayke's user avatar
  • 1
1 vote
2 answers
446 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....
Amit Maheshwari's user avatar
0 votes
1 answer
4k 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. ...
Trade On Target's user avatar
1 vote
3 answers
2k 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?
einpoklum's user avatar
  • 9,423
0 votes
1 answer
1k 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 ...
BobbyD's user avatar
  • 1
0 votes
1 answer
110 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
Julie Hester's user avatar
0 votes
1 answer
20 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 ...
Willie's user avatar
  • 3
1 vote
1 answer
462 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 ...
magneato's user avatar
0 votes
1 answer
727 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 ...
Confuse's user avatar
  • 103
0 votes
1 answer
1k 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 = ...
larsnl's user avatar
  • 1
0 votes
1 answer
124 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 ...
kripalrathod's user avatar
0 votes
1 answer
203 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 ...
BaliRobin's user avatar
1 vote
1 answer
545 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 ...
Jordan's user avatar
  • 37
0 votes
1 answer
126 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") '...
tariqfaiyaz's user avatar
0 votes
1 answer
2k 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 ...
tariqfaiyaz's user avatar
0 votes
1 answer
233 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 "...
tariqfaiyaz's user avatar
0 votes
0 answers
1k 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 ...
dfduran's user avatar
0 votes
1 answer
576 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 ...
Stefano B's user avatar
0 votes
1 answer
292 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 ...
tariqfaiyaz's user avatar
0 votes
1 answer
379 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....
MmVv's user avatar
  • 121
0 votes
1 answer
482 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 ...
tariqfaiyaz's user avatar
0 votes
0 answers
216 views

Can Excel only display the results from a FILTER, ISNUMBER, SEARCH formula and not the entire array of searched data?

I am creating a spreadsheet that can search an entire "Control" data table using two search boxes. Search TextBox1 searches by UPI Search TextBox2 searches by Zip The two search boxes are ...
user1091735's user avatar
1 vote
1 answer
1k views

VBA code to hide/unhide rows based on single cell value

I am not quite understanding why my code is not working. Essentially in cell B5 I have two options, "calc_1" and "calc_2", which the user can select via drop-down. I want rows 6 to ...
infinite_aventura's user avatar
0 votes
0 answers
38 views

Select specific slides from existing .PPT from a required index in excel document, can this be done? [duplicate]

How can I select relevant slides only from .ppt from an excel index (below)? Has anyone solved this?
matt kearney's user avatar
1 vote
1 answer
18k views

Inserting Today's Date In A Cell If Other Cell Values Are Changed or Added [duplicate]

I have a spreadsheet with a column labeled, "Status Date," in a row with several other cells, some with other dates, some with just text, and others which evaluate whether a set of ...
William S Woodson's user avatar
0 votes
1 answer
87 views

Highlight entire rows based on cell values

I want to highlight entire cell values when the row values changes. For example, row contains A A B B B C D E E Final result : i want to highlight above the row by means of A has to in one color and B ...
user1092590's user avatar

1
5 6
7
8 9
75