216,503 questions
Advice
0
votes
17
replies
241
views
Date function vba how to
I have this code that works great except for when the end of the week comes up I have to change 8 to 15 or vise versa in order to get to the correct workbook. Is there another way? This code is to ...
0
votes
0
answers
135
views
As part of a function, how could I create a variable number of sums one inside another based on a parameter?
I'm currently struggling on an assignment (probability class) which require creating a function (VBA excel) that contains a variable number of sums one inside the other based on a parameter. I'm not ...
1
vote
2
answers
103
views
Searching for a range of dates in Excel Using VBA
I have a problem in making a search for a range of dates with VBA. Using the start date as the default search in the date range and when find the same date start to count (x) in the range between the ...
-1
votes
1
answer
88
views
VBA Code for Recordset to pull information from Table to Form
I am working on pulling information from a table into a Check In & Out form. We will be cataloging helmets using barcodes. With the way I have the form set up, scanning a barcode will ...
0
votes
1
answer
101
views
insert row with total where criteria count ends
i have excel sheet with 5 columns. i used following code for sorting. it works fine
lrow As Long
lrow = Application.WorksheetFunction.CountA(Sheet2.Range("A:A"))
Sheet2.Range("A3:E&...
1
vote
0
answers
70
views
How to run VBA scripts only in the Word document I'm currently editing? [closed]
I have this code:
Private WithEvents App As Word.Application
Private Sub Document_Open()
Set App = Word.Application
End Sub
Private Sub Document_New()
Set App = Word.Application
End Sub
...
Advice
0
votes
3
replies
76
views
Prevent Duplicate Sheets when Adding using VBA
I am adding new sheets to a workbook using the value of a column.
In the column there are duplicate values. I want to skip a duplicate value in my loop.
0
votes
1
answer
94
views
How to insert nested fields in VBA for Word? [closed]
I would like to make a VBA macro for Word 2021 that will insert an IF field with STYLEREF fields inside it, to show the beginning and ending paragraph numbers in a page header.
I am able to insert the ...
Best practices
0
votes
2
replies
118
views
What is standard practice for handling VBA fixed-length string data in binary files?
I'm quite frustrated trying to write to a binary file in Excel VBA. The issue is with fixed-length string data in a Type structure. (Note that my binary file requirements are that fixed-length string ...
0
votes
1
answer
113
views
VBA Code to get a formula returned in column2 when column1 is not empty, error in my formula
I have the following VBA code, but one line is giving an error:
rng(i, 4).Formula = "=IF(LEFT(A" & (i + 1) & ",2)="RN","RN",IF(LEFT(A" & (i + 1) &...
-4
votes
1
answer
105
views
MS Access: I have a problem with an object declaration
Someone can tell me what is wrong with my code?
When I click on the btn_prelrep button, I want to get information from equipment input control, that information is concatenated with the path of a file ...
0
votes
1
answer
171
views
Why am I getting an Out of Memory error with this specific VBA code?
I have Power Query table in an Excel spreadsheet that filters a different table for a specific Index number using a List Box of Client Names.
The first table has 3 columns:
Index
Attribute
Value
1
...
2
votes
3
answers
194
views
Insert and Paste Values to a protected sheet
This Excel VBA code is supposed to copy the entries from Sheet "Entry" then Insert & Paste only Values in Sheet "List".
Sheet List has a password to prevent editing.
Sub ...
0
votes
0
answers
99
views
Importing data: VBA run-time error 1004 Application-defined or object-defined error
I am trying to import a table from one workbook to another, but I want to add the table with each import to the next empty cell (i.e. don't want to overwrite existing data in the target workbook). I ...
0
votes
1
answer
72
views
I need to stop a tab from being exported. Is there a Workbook BeforeExport similar to BeforePrint?
I have managed to stop a tab from being printed using the BeforePrint... I now need to prevent the File|Export from firing for the same tab. Is there something like the code below to stop FILE | ...
Best practices
0
votes
4
replies
113
views
Best way to extract a VBA Date out of a byte array and turn it back into a valid VBA Date?
I have confirmed that the following VBA code works just fine.
Dim mydate As Date
mydate = Date
Open "C:\Windows\Temp\dlctest.data" For Binary Access Write As #1
Put #1, , mydate
Close #1
...
-1
votes
0
answers
131
views
VBA to send email to a range of addresses, changing subject and body [closed]
I am looking to create a macro that will email a range of addresses as per the following criteria:
Column A contains email subject
Column B contains email addresses
Column C contains email body
...
1
vote
1
answer
104
views
Exporting to PDF using fields as the name
(Follow-on from: MS access Split report and export each row as a PDF )
I am exporting files to PDF based on a a report. Initially to get it working I was naming the PDF files after the Table's ID ...
1
vote
2
answers
106
views
Problem creating cell output from Date using VBA script in Excel
I'm trying to use VBA to insert a new row and then create a reference using the date in the format yyyymmdd followed by a hyphen and then 1.
So for example, today I would like the output to read ...
Advice
0
votes
3
replies
58
views
Powerpoint reset presentator timer on Slide 2 (Or leaving slide 1)
I have my presentation on the first slide while the room fills.
I would like the Presentation timer to reset when moving to slide 2.
I can't seem to remember to either, press reset or pause/start to ...
Advice
0
votes
1
replies
119
views
I want to prevent fill and drag in Excel
I want a VBA code to prevent fill and drag in an Excel sheet without hiding the fill and drag cruiser. and without preventing them from advanced settings.
In addition, I want this code to be localized ...
-3
votes
1
answer
207
views
Check if Map Chart drawn successfully or not
1) The following code is able to draw a Map Chart successfully.
Public Sub Macro1()
For i = ActiveSheet.Shapes.Count To 1 Step -1
ActiveSheet.Shapes(i).Delete
Next i
...
1
vote
1
answer
145
views
Excel VBA BeforeDoubleClick not working after other code is run
When I first open up the Excel file, as well as after I click on a button to import additional sheets into the file, the BeforeDoubleClick event works (it adds 'ticks' to cells so the user can see how ...
Advice
0
votes
6
replies
121
views
MS access Split report and export each row as a PDF
I am completely new to Visual Basic as a coding language coming mainly from Java and SQL but rusty in both of them
in current role I am working with more Microsoft Access Databases but I need to ...
3
votes
1
answer
107
views
Why does an adaptive Image control in a VBA UserForm not render as expected for different diaplay scales?
I have a simple UserForm to prototype the concept of loading different sizes of the same image based on the Windows display scale that the user sets. For this example, I'm just testing with 100% scale ...
1
vote
2
answers
115
views
wdFindStop not Stopping Replace at End of Specified Range
I have code that searches for a particular unique pattern and, if found, replaces that pattern. The replace should be limited to the paragraph in which the match is found, but instead it is executing ...
1
vote
2
answers
153
views
VBA Excel trying to get a variable defined as Range into Cells format
I'm probably missing something very simple here but, I have cobbled together the following code VBA code in Excel,, mainly from answers I've seen here and this runs OK. However what I would like to do,...
1
vote
1
answer
84
views
"File not found" copying worksheets into a new workbook
I'm working with a macro designed to copy selected sheets into a new workbook, replace their formulae with values, then resave the file in the same folder as the macro workbook. For the most part, the ...
2
votes
1
answer
64
views
Exporting a VBA module from a SharePoint file
I am trying to export a VBA module from one workbook and import it into another:
Dim ProofName As Variant
Dim sDate As String
Dim CashShN As Variant
Dim wbkSource As Workbook
Dim wbkTarget As Workbook
...
3
votes
1
answer
87
views
Change the font color of data labels in a Sunburst chart in Excel
I’m trying to change the font color of the data labels in a Sunburst chart in Excel using VBA.
So far, I’ve tried several approaches over the past two days, but I can’t seem to access or modify the ...
0
votes
1
answer
101
views
FileSystemObject FolderExists return False if there's whitespace in request(foldername)
I want to test if a foldername exists using the FolderExists method in classic asp.
My code send the foldername as a URL parameter and are received correctly using request(foldername).
But if there ...
Advice
0
votes
7
replies
121
views
VBA- getting data using partial names
I am working with two different workbooks. WB1=Destination data, WB2=Source. I am trying to do a lookup and match between the wb, using wb2 to find the match in WB1. Once the match is found, copy ...
1
vote
1
answer
72
views
Excel VBA, is it possible to select column/row range within a table to paste information into, and use torow for it?
I am trying to get data from my data imput sheet into my record keeping table, so I am trying to do VBA code to
1. create new row
2. paste the data in there as value and not formula
I created ...
1
vote
1
answer
104
views
Value automatically filled in an Excel Workbook based off of data being entered into another Workbook
I'm looking for a way to have a value automatically filled into an Excel Workbook based off of data entered into another Workbook. I currently have a spreadsheet which serves as a Daily Attendance ...
2
votes
0
answers
191
views
VBA Excel sending email has been "reduced" in abilities
For years I have had code similar to the following, and it has always worked fine.
But now we recently updated to Win 11, perhaps it is related or there is some other update or policy change that ...
Advice
0
votes
2
replies
124
views
Excel VBA SQL Insert or Update Data in closed workbook
I use SQL to read data from a closed workbook. Is it possible to write new records or updates to a record in a closed workbook using SQL?
0
votes
2
answers
107
views
Excel Macro Loop. Looking for code to loop through entire workbook
I am new to making macros and have basically no experience with VBA. However, I have managed to cobble together the code below.
The code is supposed to load data from a worksheet (the name of which I ...
0
votes
1
answer
58
views
Using FDF in 64 bit Adobe Acrobat API?
We have a VBA process that uses the Adobe Acrobat API. This uses the FDF functionality for filling in a PDF template fields with data.
When we went to 64-bit O365, the AddIn provided by Adobe no ...
1
vote
2
answers
158
views
Trouble with VBA Class Instantiation [closed]
I've created a VBA Class module and written all the necessary code within it. When I go to use it, in Excel, I instantiate it in a global module as follows.
Public gblFrequencyList As New clsLists
...
1
vote
2
answers
95
views
How do I save a file as a specified cell value, then clear content of all unlocked cells, then close the file, then open another specific file?
I tried the below, but it is not doing exactly what I need it to. Instead of unprotecting the sheet and clearing the contents of grey cells (191, 191, 191) I'd like to change the approach and clear ...
1
vote
0
answers
124
views
Transferring data from one Excel workbook to another with ADODB.Connection reformats dates
I set up an event listener in Outlook that, when a certain item drops into a mailbox, will take the attachment from the email, unzip the file and save it into a directory.
I use ADODB.Connection to ...
4
votes
2
answers
165
views
Excel VBA Type Mismatch on Row Delete
I have a "simple" comparison that is generating a "Type mismatch" error when I delete a row in the worksheet (worksheet change event fires).
If Target.Column = gblScheduled And ...
0
votes
0
answers
74
views
How to figure out what error the IDE has identified with this bug icon?
I'm trying to write a script for Attachmate EXTRA! X-treme in its in-application macro editor ("Extra Basic"), but there's some syntax problem or error occurring in the code that's ...
2
votes
3
answers
102
views
Skip invalid inputs when finding Min and Max values
I'm working on a VBA problem to find the maximum and minimum values in a sequence while skipping invalid inputs.
The issue I'm facing is that when the first value in the sequence is invalid, the ...
2
votes
1
answer
126
views
Create text file for output
I am writing VBA code in an Excel spreadsheet. I want to output the results to an ASCII (text) file.
I google-checked the "Open" command to open a file and associate it to a file number. The ...
-1
votes
1
answer
88
views
Creating a new folder in Sharepoint using VBA for Excel [closed]
I am trying to create a folder at https:\\myorg.sharepoint.com\sites\CASH ORDER\Testing using...
MkDir "//myorg.sharepoint.com/sites/CASH ORDER/Testing"
...but I keep getting a run-time ...
Advice
0
votes
3
replies
95
views
When a user selects all cells and resizes a column, all hidden columns are redisplayed - How can I detect that and rehide the unhidden columns
User selects all cells via Ctrl+A or clicking in the box above the Row numbers and to the left of the Column letters
With all cells selected, if they auto resize any column
a. All hidden columns are ...
-2
votes
3
answers
153
views
How do I bold every other name in repeating rows in a single column in Excel? [closed]
In column A, I have a list of names.
The names repeat sometimes, depends on the data.
.
I want to format the list by bolding every other name.
Is there a way to automate this bold formatting?
The ...
1
vote
1
answer
102
views
Creating a clone product under selected root assy
This code was supposed to create a cloned product under the selected root assembly with the exact same structure. Instead, it is creating only a component assembly, as shown in the image. I need it to ...
1
vote
1
answer
120
views
My "MoveRowsTo" Module is only moving to one row
Basically I have a task list, and once the tab is labeled as "closed" in column G of the "Open Items" Sheet, It needs to move to the "Closed Items" sheet.
The function ...