dim

  1. K

    referencing cells from vba

    as shown in code below, i have defined two varible m and n and tried to use these variable for addressing a cell like range("cn") in place of range("c4") during first loop, but it shown run time error 1004 , cant i address a range in this way? Sub test() Dim diameter As Long Dim maxcap As Long...
  2. K

    Workbook_Change stopped working !

    I am working on an app to speed up & automate processing of Credit Cards statements. After data is input from a CSV file, it is presented to the user. The user is allowed access to 2 columns, 'Account Code' & 'VAT Rate'. Entry is restricted by Data Validation, the user selecting from...
  3. S

    Loop issue to export picture

    Hi all, I want to export a group of shapes as an image. The group consists of various shapes that are displayed / hidden based on user selection and show incident types on a map. All I want is to export this map to a JPG. I have crafted a script from various finds online, it works sometimes...
  4. F

    Select account to send email from

    Hi I have a code that runs through a list of people and sends individual files to each one. The code automatically sends the emails from one of two email accounts I have. Problem is, it's the account that isn't associated with the message! As this spreadsheet will be used by many different...
  5. S

    Find last available row in a range of cells

    Hello, I am looking to make a code work in the way that it finds the last available empty row in columns A to L since M will have data pull with a formula. But I am not sure how to or where to add the range to make it work. Can I please ave your help? Dim iRow As Long Dim ws As Worksheet Set...
  6. R

    For Each Visible cell in range, get me the left 6 characters

    Hi all, venturing into the wild world of For Each instead of Do Until loops, have the following: Dim LastrowAD As LongDim cl As Range Dim visrng As Range LastrowAD = Cells(Rows.Count, "A").End(xlUp).Row Set visrng = Range("A2:A" & LastrowAD) For Each cl In...
  7. K

    Code has error in email to PDF

    Sub AttachActiveSheetPDF() Dim IsCreated As Boolean Dim i As Long Dim PdfFile As String, Title As String Dim OutlApp As Object ' Not sure for what the Title is Title = Range("A1") ' Define PDF filename PdfFile = "Sharp_Air_Estimate" i = InStrRev(PdfFile, ".") If i > 1...
  8. J

    VBA Error 1004 (Global Range Failed)

    Hi, It has been a few years since I have really wrote any substantial amount of macros. This one is a few years old and I am trying to identify the issue and feel like it should be coming to me easier. I am hoping someone else with a little better knowledge base might be able to identify it...
  9. K

    Deleting Worksheets except for one, in Copy of workbook

    Hello, I'm am trying to make a copy of a workbook, which I then open and then I want to delete all sheets except for the sheet "OrderformulierKopie". The code I'm using right now keeps giving the error it is out of range (in the for loop). I can't figure out how to fix it. Ivlgnr is made in...
  10. T

    Collections

    In this code: Dim Rng As Range Set Rng = Sheet1.Range("A1:D4") Dim RngElement As Range For Each RngElement In Rng RngElement.Value = 100 Next RngElement it populates every cell in the range A1 to D4 with the value of 100. I was of the understanding that the variable RngElement...
  11. H

    Excel VBA GetFolder from 2 Drive (2 location)

    I had a code which work very well for 1 location (path) Possible to open and run 2 location? Sub GetFolder() Range("A:L").ClearContents Range("A1").Value = "Name" Range("B1").Value = "ParentFolder" Range("A1").Select Dim strPath As String strPath = "K:\VIEWING" 'strPath(0) =...
  12. D

    VBA IF THEN with 2 conditions

    Hi All I have this piece of code that is giving me a Runtime error 424 I need it to check every cell in V and every green cell with value 0 it need it to remove its colour, can anyone tell me why I am getting the error. Dim b As Long Dim i as Long Dim D As Range b = 2...
  13. L

    when white space is important in VBA?

    Hi the code below is working. However if I do not put white space between x and i in line 6 I would get "expect end of statement" error message. Why white space in important here? Thanks a lot. Sub ws_name() Dim x As String Dim i As Integer x = InputBox("enter name") For i = 1...
  14. Pinaceous

    VBA Private Sub; posting question...

    Good Afternoon, I have a Private Sub that I have posted onto Sheet1 (Sheet1) that works great on its tab. Now, if I wanted to have this Private Sub to work on every sheet of the workbook, I thought I would post it onto ThisWorkbook but it does not work upon every sheet of the workbook. Do I...
  15. kweaver

    VBA cannot find SUMIFS in WorksheetFunction class

    What's wrong here? Dim Arg1 As Range 'the range i want to sum Dim Arg2 As Range 'criteria range Dim Arg3 As Range 'the criteria (range) Set Arg1 = Sheets("TextFile").Range("M5:N10000") Set Arg2 = Sheets("TextFile").Range("K5:K10000") Set Arg3 =...
  16. L

    Sending Emails to Muliple People

    Hello All, I'm working on editing this VBA code below to allow edits in additional cells to trigger an email sent to additional email address. Could anyone help me edit this code to allow for this? Private Sub Worksheet_Change(ByVal Target As Range) 'Updated by Extendoffice 2017/9/12 Dim...
  17. H

    Get the List of multiple Folder in Excel

    possible to Import List (path) of Folder Names from multiple Folder in Excel Sub ListFolders() Dim MyPath As String, MyFolderName As String, MyFileName As String Dim i As Integer, F As Boolean Dim objShell As Object, objFolder As Object, AllFolders As Object, AllFiles As Object...
  18. S

    Macro to hide a specific row in column C with the following macro which I want to use to unhide as a toggle

    Hi all, I have a macro which hides all rows in a column within my specific spreadsheet as per the ranges used. I would like to set my macro up to toggle between hiding and then unhiding so need something to reverse the process. The following is the code I have used: Sub HideUnusedRows() Dim...
  19. D

    Object required

    I am getting the object required error with this code: Sub cmdCopy() Dim wsDst As Worksheet, wsSrc As Worksheet, tblrow As ListRow Dim Combo As String, sht As Worksheet, tbl As ListObject Dim lastrow As Long, DocYearName As String, Site As String, lr As Long Dim RowColor As Long...
  20. A

    Help adding loop

    hello all! i am learning to code, and have 7 books but still have such a hard time understanding loops. i'm desperate for help. My boss wants me to loop through a years worth of files and pull data. I tried for days, and am just not retaining the rules behind the action. I hope someone will just...

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top