Macros and VBA
6471 TopicsSwitch Panes Using F6 not working
I am using split panes to type a formula and I want to reference something from the top of the worksheet. When I press F6 to send me to the top pane, instead, it is sending me to the bar on the bottom of excel and the top ribbon. It is so frustrating because this worked for me before and now it is not working and is slowing me down greatly. I was wondering if anyone could help? Thank you.78Views0likes4CommentsExcel (365 & 2016) with network information...and much more Information to Filter.
With Excel (365 & 2016) Network information, information about Local Network Connectivity, Test Connection to a Specific Web URL, WiFi SSID information ...and much more information to filter with a button. I was trying to create a tool that would allow me to filter the necessary information from all the PCs I need to work on using a USB stick. I came across an old file that I edited and added additional information to the code. I'd like to share this file (Help for self-help). If anyone finds it useful, or would like additional tips or information, please feel free to send me feedback. If it doesn't help you...just ignore it. I welcome any constructive comments. * After loading the file, be sure to activate all macros. Happy Excel-ing! 🙂30Views0likes0CommentsCreateObject("Outlook.Application") with New Outlook
Hello, I've just noticed that when using the New Outlook, the VBA command CreateObject("Outlook.Application") generates the following error: "-2146959355 (80080005) Server execution failed". Am I the only one experiencing this issue? Or is there a need to modify the command? This works perfectly fine on the classic version of Outlook. Thank you in advance16KViews0likes7CommentsMacro Error for Pivot Table
I can create a Pivot Table for the data I download and it works fine. However, when I made a Macro to do the same thing, I get an error. The error is: Run-time error '5': The following is a screenshot of the highlighted error in the Macro. I am now using Excel 2013, however I made an initial Macro using an older version of Excel and am now trying to make a pivot table using 2013 and installing it near the start of the existing Macro I have. How do I correct for this error?24KViews0likes11CommentsHighlight or Change the font color for only a specific word and not the entire cell in Excel?
Hi there. This is my first post, and I hope someone can help me. I have a large spreadsheet I need to look through to find specific keywords and either highlight those keywords or change the font color so they draw the reader's attention. I am unable to figure out how to do this automatically without highlighting the entire cell. Each cell has multiple lines of text, so I do not want to try to read through each cell to find the one word or key phrase to highlight or change the font size on my own. I need this to be an automatic action. Any takers out there willing to give me a hand? Thanks in advance.Solved122KViews1like11CommentsBest method to find variances between checkbook deposits and GL deposit transactions
I'm looking for a way to find variances between checkbook deposits and General Ledger deposit transactions. Single checkbook deposits post to the GL as multiple entries (deposits are exported to the GL from a different platform). For example, a single deposit of $10,000 in the checkbook may actually be 5 checks of $2000 each, which post to the GL individually. This wouldn't be an issue except there are often over 3000 individual GL entries and 1000+ checkbook deposits in a given month. I need to determine which groups of GL entries equal each checkbook deposit in order to find the variance. Below is a very simplified version of what I'm looking at. I have tried subtotaling by date, but this doesn't work well, because each checkbook deposit can send entries to the GL with multiple check dates. I have considered Solver, but this problem seems too complicated for that method. Is there a way to do this in Excel, or do I need something more sophisticated? I am an advanced Excel user, but the answer to my problem has eluded me, so far. Thanks for your help.112Views0likes6CommentsHelp with Excel report creation for review results from multiple worksheets...
Windows 11 MS Office 365 Cloud Accessed from Citrix desktop I've been working on this project for a while and have a tracking spreadsheet for several review categories, each on its own worksheet tab. I have a results page that gives me the data I need. The table on the RESULTS tab contains the results for the reviews and marks them as either having 'Not Met', 'Met' or 'Exceeded' the goal for each category. The final piece of the project is giving us problems. I received a great deal of help with it from @HansVodelaar here on the forum and he got very close to solving it. I've included the spreadsheet with the final attempted 'Result' tab. Here is what I'm trying to do now... Automatically generate a simple report Based on the generated date on 'RESULTS' for the selected Rep That lists all records, Labeled by review category (see review tabs), From the designated start date to designated end date, Only for the categories with scores designating them as either 'Not Met' or 'Exceeding' the goal. So far, the 'Report' tab works to list the records. However, there are a couple of problems with it. I can't seem to successfully copy the formula to the master workbook, which holds the same structure, but is not redacted. The returned data, as is, only separates the categories by a blank line, but does not identify to which review tabs (categories) the results belong. Any help offered is greatly appreciated. Hans suggested that the solution may require use of Power Query. So, if anyone has an idea of how I can accomplish this report without having to go into each tab to filter, sort, format and print, it would be totally awesome!!Solved504Views0likes41CommentsWriting a value in a ByRef Variant argument holding a LongLong
Hi all experts, I maybe found a strange behaviour in vba (Retail 7.1.1146) about Reference to a LongLong argument in a function: if the argument is declared as a variant, inside this function the argument value can be read but not written. The here attached code Option Explicit Private Function Texte_Erreur() As String Texte_Erreur = "Erreur " & CStr(Err.Number) & " : " & Err.Description End Function Private Function Test_Integer_V(ByRef xv As Variant) As String On Error GoTo L_Erreur xv = CInt(13) Test_Integer_V = CStr(xv) GoTo L_Fin L_Erreur: Test_Integer_V = Texte_Erreur L_Fin: End Function Private Function Test_LongLong_V(ByRef xv As Variant) As String On Error GoTo L_Erreur xv = CLngLng(14) Test_LongLong_V = CStr(xv) GoTo L_Fin L_Erreur: Test_LongLong_V = Texte_Erreur L_Fin: End Function Private Function Test_Integer(ByRef xv As Integer) As String On Error GoTo L_Erreur xv = CInt(15) Test_Integer = CStr(xv) GoTo L_Fin L_Erreur: Test_Integer = Texte_Erreur L_Fin: End Function Private Function Test_LongLong(ByRef xv As LongLong) As String On Error GoTo L_Erreur xv = CLngLng(16) Test_LongLong = CStr(xv) GoTo L_Fin L_Erreur: Test_LongLong = Texte_Erreur L_Fin: End Function Public Function Test(n_test As Integer) As String Dim var_Integer As Integer Dim var_LongLong As LongLong Select Case n_test Case 1 var_Integer = CInt(11) Test = CStr(var_Integer) Case 2 var_LongLong = CInt(12) Test = CStr(var_LongLong) Case 3 Test = Test_Integer_V(var_Integer) Case 4 Test = Test_LongLong_V(var_LongLong) Case 5 Test = Test_Integer(var_Integer) Case 6 Test = Test_LongLong(var_LongLong) Case Else Test = "Test non supporté" End Select End Function Public Sub M_Test() Dim xs As String xs = Test(1) xs = xs & " - " & Test(2) xs = xs & " - " & Test(3) xs = xs & " - " & Test(4) xs = xs & " - " & Test(5) xs = xs & " - " & Test(6) MsgBox (xs) End Sub allow to verify this problem (M_Test macro execution or using Test Function in a sheet of an Excel File): - Tests 1, 3, 5 are tests using an Integer - Tests 2, 4, 6 are similar tests using a LongLong - Tests 1 and 2 are using directly variables - Tests 3 and 4 are using variables through a function with the ByRef argument declared as a Variant - Tests 5 and 6 are using variables through a function with the ByRef argument declared as an Integer or as a LongLong Tests 1, 2, 3, 5, 6 have the expected results. Test 4 raise an error "Erreur 458 : Cette variable utilise un type Automation non géré par Visual Basic": Why this behaviour difference between Integer and LongLong? It works fine with Byte or Long or Single or Double as it works with Integer. Why with LongLong an error raise in Test 4?Solved124Views0likes8CommentsVBA help needed
Hi I am trying to create an excel spreadsheet for a football tipping competition (for family & friends) I am using Excel 365. I asked this question to an AI bot program "I have an excel sheet with 27 tables named table 1 to table 27, I need to fill a table with 27 columns and 48 rows, I can only use the names from table 1 to randomly but equally fill all 48 rows in column 1 in the table, the same with table 2 to fill column 2 and so on through to table and column 27. The names on each row cannot be repeated more than twice." It has generated this script. { "vba_script": "Sub FillTables()\n Dim ws As Worksheet\n Set ws = ThisWorkbook.Sheets(\"Sheet1\")\n Dim i As Integer\n Dim j As Integer\n Dim tableNumber As Integer\n Dim nameIndex As Integer\n Dim usedNames As New Collection\n For i = 1 To 48\n For j = 1 To 27\n Do\r\n tableNumber = Int((27 - 1 + 1) * Rnd + 1)\r\n Loop While usedNamesCount(ws.ListObjects(\"Table\" & tableNumber).ListColumns(j).DataBodyRange.Value) >= 2\r\n usedNames.Add ws.ListObjects(\"Table\" & tableNumber).ListColumns(j).DataBodyRange.Value\r\n ws.Cells(i, j).Value = ws.ListObjects(\"Table\" & tableNumber).ListColumns(j).DataBodyRange.Value\r\n Next j\n Next i\nEnd Sub\n\nFunction usedNamesCount(name As String) As Integer\n On Error Resume Next\n usedNamesCount = usedNames(name)\nEnd Function" } I am only a novice with Excel & was wondering if anyone would like to have a go at it for me. Thanks Bill340Views0likes1CommentVBA multiple select no repeat dropdown not working
Hello, I have an excel with one column as a multiple select no repeat dropdown. It was working fine until I added a row now none of the column will allow multiple select. I have used the data validation, selected the multiple items and added the VBA again but no luck. This is the VBA I am using: Option Explicit Private Sub Worksheet_Change(ByVal Destination As Range) Dim DelimiterType As String Dim rngDropdown As Range Dim oldValue As String Dim newValue As String DelimiterType = ", " If Destination.Count > 1 Then Exit Sub On Error Resume Next Set rngDropdown = Cells.SpecialCells(xlCellTypeAllValidation) On Error GoTo exitError If rngDropdown Is Nothing Then GoTo exitError If Intersect(Destination, rngDropdown) Is Nothing Then 'do nothing Else Application.EnableEvents = False newValue = Destination.Value Application.Undo oldValue = Destination.Value Destination.Value = newValue If oldValue = "" Then 'do nothing Else If newValue = "" Then 'do nothing Else Destination.Value = oldValue & DelimiterType & newValue ' add new value with delimiter End If End If End If exitError: Application.EnableEvents = True End Sub Private Sub Worksheet_SelectionChange(ByVal Target As Range) End Sub Any help is appreciated!52Views0likes1Comment