1. D

    Using IPhreeqc in Excel

    I can't get excel to do what I want after creating this VBA script: Sub sbCopyRangeToAnotherSheet() LastColumn = ActiveSheet.UsedRange.Columns(ActiveSheet.UsedRange.Columns.Count).Columns For n = 63 To 63 For i = n To n Worksheets("Data").Activate...
  2. W

    Runtime Error 13 in my code

    I am getting a run time error 13 in my code between the **. Can anyone out there see why? For some reason the code will run and do what I want, but then spit out the error. Any help will be appreciated. Sub Recon() Dim i As Integer finalrow =...
  3. A

    Loop to merge cells does not work on last few rows

    Hi all! Im having some issues with my code below. It works fine on majority of rows, but towards the end, it's having some issues. What my code does is this: - if values of cells (i,j) and cells (i+r,j), basically 1 cell and the cell below it are the same, then they merge and other columns...
  4. A

    VBA code to add company logo at the end of the email with attachements

    Hi I have a macro which I wrote from watching a couple of YouTube videos, it works however, I would like to add the company logo at the bottom of the email, the image is saved in W:\company\logo.jpg. My codes are as follows: Sub send_email_with_attachments() On Error Resume Next Dim o As...
  5. K


    Hi All, I have come across a code which am having hard time with. I need the userform information to be entered into another sheet, which is not working. I need the Macro to update the table with new/edit previous information.
  6. S

    Goal Seek Analysis "If cells are less than 0, than 0" isn't working.

    WhatIfAnalysis Macro ' ' Keyboard Shortcut: Ctrl+g ' Public Sub GoalSeeker() For i = 3 To 187 cells(i, "AG").GoalSeek Goal:=0.15, ChangingCell:=cells(i, "AF") cells(i, "AF") = WorksheetFunction.Round(cells(i, "AF"), 2) cells(i, "AF") < 0 = 0 Next i End Sub
  7. J

    Referencing table in another workbook

    Hello: I have a formula in a CurrentSheet that is looping through data looking at the headers of a data table (data_table) in the same workbook for index and match. That code works fine and is below. However, I need to make it refer to another data table in another workbook for the data. That...
  8. J

    Cleaning up records

    Hello: I have part of a macro that needs to clean up cells and replace the bad data with the good data. I'm using a loop nested if else, but is there a more efficient way? This looks cumbersome. Any help would be appreciated . Thank you! Sub cleandata() Dim i As Long Dim DataValue...
  9. J

    Index Match formula Loop

    Hello: I have the following formula that I need to replicate down a column. When I paste it, it works fine. But when I try to put it into a loop, I can't seem to make it work. The failing loop is below. Thanks! The Formula: =Cells(i, 5).Formula = "=INDEX('Temp...
  10. J

    Date loop

    Hello: I need a sub to input last month's date into a column of data and then hard code the date. The only solution I came up with is below, but I'm wondering why it's not creating a circular reference. Thank you! I'm sure it has something to do with equivalency, but I'm still new! Sub temp()...
  11. J

    Loop through data and create formulas

    Hello: I have the following data. I want col A to equal the value of the first cell to its right, but retain it in a formula. For example the successful result in A2 would be "=B2" not "1". The following code gets the value in col A but it's a value, not a formula. Thank you! <tbody> A B C D...
  12. J

    Checking if a record exists already before using SQL INSERT ?

    Hi, not sure if this fits into the excel category but its what im using with ADODB Sub insertSQL() Application.ScreenUpdating = False var1 = Sheets("Sheet2").Range("A1") Set cnn = CreateObject("ADODB.Connection") cnn.Open MyConn Rw = 2 For i = 2 To Rw val1...
  13. B

    Delete If Met

    Evening All Wondering if someone could lead me to an alternative. The below Loop deletes the row if a cell condition (Text "Test") is located in Column J, also looking to delete the 3 rows above. Coincidentally found a similar request on the forum yesterday, however unsure how to amend. Thank...
  14. P

    Problem deleting rows in VB

    Morning, I have a code which should be deleting a selection of cells if the word does not start with LMK or DUB or ORK but it seems to delete it even if it does, can anyone spot the error of my ways please ? For i = LastRow To IRStartCell Step -1 K = Cells(i, 18) If K <> "DUB*" Or K <>...
  15. L

    Entering ifs only once in a cycle

    Hello guys, i am going through a 100 rows and adding the numbers up together, it sums to a 100. Once it reaches 70, 85, 100, different actions are taken. This is pretty much a manual conditional format. My code: For i = 2 To lastRow endChecker = range("D" & i).Value + endChecker...
  16. A

    Creating Folders with VBA

    Hi all, I have been reading all posts but cant come across the answer. I am using this code: Sub createFolders() Dim fpath As String Dim i, xc As Integer For i = 1 To ActiveSheet.UsedRange.Rows.Count xc = Range("XFD" & i).End(x1ToLeft).Column If xc = 1 Then fpath =...
  17. D

    VBA Extract Data and Paste to another sheet

    Hello, I'm only new to VBA and have been able to get some pretty cool stuff done to my database for my transport company. I am trying to copy data based from my data sheet "Data" to report sheet "Pre Alert" based on 2 criteria's selected on "Pre Alert" sheet. The code have is below. When...
  18. C

    Matching a time value in a cell to read the correct value of Now...

    This code ' Option Explicit Dim MyRunTimer As Date col headers A = Date B = Time C = Message Sub MyMacro() MyRunTimer = Now + TimeValue("00:00:10") Dim i As Variant, t As Date, s As String If Range("D1") <> "" Then Exit Sub Else For i = 2 To [A65536].End(xlUp).Row If Cells(i...
  19. O

    VBA Loop Gives Double Lines of Errors

    Thanks in advance for any suggestions for which feedback will be given. This code runs through a series of tabs and wherever it sees an error, it takes that line and places it in the "Error.Items" sheet. Why is it duplicating each error? I guess I could write code at the end to remove the...
  20. V

    Only run macro if the first column contains text - VBA Excel to Outlook

    Hi All, This is my current code: 'binding Sub bulk_email() On Error Resume Next Dim o As Outlook.Application Set o = New Outlook.Application Dim omail As Outlook.MailItem Dim Signature As String Dim i As Long For i = 2 To Range("A10000").End(xlUp).Row Set omail =...

Some videos you may like

This Week's Hot Topics