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...
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 =...
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...
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...
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.
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
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...
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...
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...
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()...
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...
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...
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...
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 <>...
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...
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 =...
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...
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...
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...
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 =...
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.