long

  1. G

    Error with the below code "Can't find project or library"

    Hi Everyone, I am working in a project and below is my complete code. Option Explicit Sub Try() Dim TOrig As String, STMonth As Long, SCMonth As Long, ECMonth As Long Dim I As Long, J As Long, CMon, cCol As Long Dim lrow As Long Dim add_month As String add_month = InputBox("Insert the...
  2. B

    Randomize where a random number is limited to the number of repeats

    I have this code to select a random number up to the value I enter in Cell A1 In Cell B1 I enter the number of rows I want to fill. This VBA ensures that each number is only selected once The problem I have is that sometimes Cell B1 is a larger number than cell B2 so I want to be able to enter...
  3. J

    adding code to an existing macro

    hi all, i have a macro set up which works great and i want to add the below code to it, i know where i need it to fit in but i dont know how to get it to work after Sub MonthlySpreadsheetJanuary() Dim List As Variant Dim LR As Long Dim r As Long List = Array("Cash Movement") LR = Range("C" &...
  4. H

    Excel VBA to rename filesname or folder

    Hi Any idea why this not working? :D Sub ChangeInFolder() Dim OldName As String Dim NewName As String Dim LastRow As Long Dim i As Long LastRow = Range("A65536").End(xlUp).Row For i = 1 To LastRow OldName = Range("A" & i).Value NewName = Range("C" & i).Value Name OldName As...
  5. TAPS_MikeDion

    Is there a shorter way to find the next available number?

    Hi everybody, Below is the code I'm using (it does work) to find the next available number in a series of numbers in column A. I search through column A, find the missing numbers, put them into an array and then find the smallest number in the array. Is there is a more simplified/efficient way...
  6. D

    Copying from one table to another

    I have some code that used to copy certain columns from every record in a table on one sheet to new rows of a table on another sheet. I didn't change anything but it has stopped copying the rows when I run the code. This is the code: Sub cmdSend() Application.ScreenUpdating = False...
  7. T

    Messagebox listing going down instead of across

    The code below lists the address of all cells in a pre-defined range whose value is zero. Dim Rng As Range With ws Set Rng = .Range(.Cells(1, 1), .Cells(1,1000)) End With Dim ZeroColl As Collection Set ZeroColl = New Collection Dim...
  8. M

    VBA to convert column range of date to long int

    Hi Folks, I have a script that copies ranges (columns) of data from one workbook to another. It copies a column of Dates in format MM/DD/YYYY and I'd like to convert that entire column to long integer. So here is my code that copies the columns over: Dim nmary As Variant, sh1 As Worksheet...
  9. O

    [Windows API] Popup menu and selected text

    Hello, I've already tried to use the Office.CommandBars class to implement popup menu with text boxes. It seems to perfectly work on Excel, but I don't actually develop the userform in Excel, but in CATIA (CAD software which comes along VBA7 64 bits). Importing the Office library doesn't seem...
  10. N

    Check for duplicates

    Hello, I have a userform with 8 textboxes (txt_Name1, txt_Name2...txt_Name8) I'm trying to add a piece of code to check the textboxes above if any name is duplicate, I tried the following code but didn't work Can you please help me? Code: Private Sub cmd_Add_Clich() Dim i As Long For i = 1...
  11. kweaver

    VBA: need unique values from a column

    In a worksheet (called Summary) I have values from G2 to Gn and I'd like column H from H2 to however long to be the unique values from G.
  12. J

    Loop and Long Formula

    Hello: I have a loop that is filling in formulas based on a cell value. The formula for "A" is fairly simple and is included in the code as a formula. But the one for "AB" has a lot of nested ifs and it's so long, I couldn't get it to work -- I kept getting syntax errors. So, I decided to simply...
  13. P

    Problem with duplicates

    Hi All I'm using the code below to create template copies, how can i adapt it to avoid duplicates please and only create unique worksheets. Sub NewDays() Dim i As Long, LastRow As Long, wksht As Worksheet Sheets("Tides").Activate LastRow = Cells(Rows.Count, 1).End(xlUp).Row For i = 1...
  14. kelly mort

    VBA - get active printer status

    Private Declare Function GetPrinterApi Lib "winspool.drv" Alias _ "GetPrinterA" (ByVal hPrinter As Long, _ ByVal Level As Long, _ buffer As Long, _ ByVal pbSize As Long, _ pbSizeNeeded As Long) As Long Private Type PRINTER_DEFAULTS pDatatype As...
  15. W

    How to export filtered listbox contents into an excel file?

    I am using an userform with a listbox and I want to export the filtered listbox contents into an excel file. myarray = Sheet61.ListObjects("Data").DataBodyRange.Value With ListBox1 .List = myarray .ColumnCount = 25 .ColumnHeads = False End With This code loads the DataBodyRange.Value into...
  16. G

    Show names in message box.

    Hi everyone, I am using vba to count the number of cells in a worksheet that contain "0" and the number of cells that contain a value then display the results in a msgbox, this code is working fine... what i would like it to do if possible is to also show in the same message box the members...
  17. G

    Vba Delete row if data from another cell exists

    Hi, I have the below code however I need to change it to reference cells C4-C4 and delete the row, if Column H contains the data typed in cells C4-C7. Thank you for any help . Sub Loop_Example() Dim Firstrow As Long Dim Lastrow As Long Dim Lrow As Long Dim CalcMode As Long...
  18. G

    Can I amend a macro to repeat with different rows

    Hi I have this macro that moves data from column G when it contains specific requirements. What im trying to do is to repeat it so if column H contains the specific data then I need data from columns H & I into column BB and then if column I contains the data I need the data from I & J moving...
  19. K

    Help:Need to import two tables only from web pages at a time

    Dear friends, I would like to import the following: Table 0 from: https://www.global-rates.com/interest-rates/libor/american-dollar/american-dollar.aspx Another table named: additional information per maturity from: https://www.global-rates.com/interest-rates/libor/american-dollar/2019.aspx...
  20. S

    Help to correct code with textbox in form

    Hi all I want to check value in textbox1 in form(CDKT) with sheet("nb","ngb"). If found will copy row to sheet(ky1) and Ihave code below Code yelow at line: Set ans1 = TextBox1.Value And have VBA notice: "Object require" Please help me correct this code, thanks Sub...

Some videos you may like

This Week's Hot Topics

Top