Unable To Edit Macro To Loop Correctly

Oct 22, 2009

I need the macro I created to run (when assigned to a button) in specific sheets in the workbook, additionally if the workbook is saved under a different name by the user, the macro will continue to work. There are 10 sheets. I need it to run in sheets 6-10, when the button is clicked in sheet 5.
Then end goal in mind is to assign this macro to a button, so the user ,when ready ,can click the button to produce the results.

Background & Current Results :
My macro is simply an advance auto filter that copies the filtered data from sheet 3 to sheets 6-10 (non-unique values).
When applied per sheet , it works . When I modify the macro (I've tried several ways based on info published here) , the best result i can get is the data copies 6 times in the same page ( whatever active sheet is selected.). I have not assigned the modified macro to any buttons, why bother if I can't get it to run in the 1st place .

I suspect I need to redo the whole thing to have it simply copy the filtered data repeatedly to sheets 6-10 , but I am not that savvy to figure that out .

My Current Macro that Works Per Sheet
Sub tcktoriginal()
'
' tcktorginal Macro
' macro to run tickets
'
Range("F4").Select
Range("cpt.code.table.").AdvancedFilter Action:=xlFilterCopy, CriteriaRange _
:=Range("A1:S3"), CopyToRange:=Range("A11:S11"), Unique:=False
Range("F5").Select
End Sub

Examples That I have Tried and Didn’t Work ........................

View 9 Replies


ADVERTISEMENT

VB Data Sorting Macro Unable To Sort Correctly

Jul 12, 2009

I am putting together multiple worksheets with dumped data that should sort themselves by the press of a button. Each entry has a 'code' and a value and they are sorted by the 'code'.

At the moment i have the first worksheet sorting correctly and i am trying to program the second worksheet to sort data into the existing worksheets if they exist or create a new worksheet if the data doesn't have it's own worksheet.

Here is the code i am working with.

View 12 Replies View Related

Unable To Sort Correctly

Oct 23, 2007

I have a column with a value resulting from a fairly complex formula:

I will not include the formula, but basically what it does is a number of calculations including subtracting dates, that is

TODAY'S DATE - A GIVEN DATE (provided in a different cell)

That means that, either manually or automatically, those values are constantly recalculating (with every second that goes by, that value changes).

And the number of values/cells to update is not few: about 1100.

Here's the problem.

When I press SORT, Excel seems to be absolutely incapable of sorting that list correctly. The values are completely and randomly out of order.

I wonder if it could be due to the fact that given that those values would be constantly changing, there would be a conflict with the commands

sort
update

View 9 Replies View Related

Excel 2010 :: Unable To Recognize Cell That Contain Colon Correctly

Oct 4, 2011

i have encountered a problem which happens when you write data that contain : in an excel sheet (i use excel 2010)

for instance if i enter to one of the cell 45:58 excel sees it as 01/01/1900 21:48:00 when i try to get the information by using a function i will get the wrong data for example typing in the different cell LEFT(Cell,5) will result 1.908

(i receiving the data from an outside source in this way and i need to make analysis)

i have noticed that the first 2 digits (21 in the example) are related to the number i have choosen in a 24 hour cycle for instance

24:58 will result 01/01/1900 00:58:00
26:58 will result 01/01/1900 02:58:00
48:58 will result 02/01/1900 00:58:00

View 7 Replies View Related

Unable To Delete Or Edit Comments

Feb 9, 2009

I have a comment which I wish to edit, but I am unable to either edit or delete the comment. I have checked the 'shared workbook', 'shared worksheet', and 'protected cell' options and they are all turned off (never had them on).

The cell I have the comment on has a dropdown box, but I can't see that being a problem. I am able to add a comment, which I can edit and delete, but the original comment seems to be 'stuck'.

View 3 Replies View Related

Loop Through Multiple Files And Call Macros (but Unable To Loop)

May 14, 2014

Macro which loops through a number of files and calls the same macro in each of them. Unfortunately when I add "Application.Run..." to the code, it no longer loops through the process and instead stops after updating the first file in the loop. If I remove the "Application.Run..." code and add any other code, the loop works fine and it continues through the process repeating all the steps for each file found.

Why it stops after one file when using "Application.Run..." to call the macros?

NB I have a list of path and file names starting in row 8 of columns A and C. Each file in the list has a macro called UpdateS1 and promoupdate1.

Sub C_Run_Loop_Macro()
Dim lastRow As Long
Dim i As Long

[Code]....

View 4 Replies View Related

Unable To Edit Links With Workbook Open Because Of Invalid Reference?

May 31, 2013

I'd prefer to edit links with the source workbook open, however I receive this error when I do "A formula in this worksheet contains one or more invalid references." I am able to edit links with the source workbook closed but this takes far too much time to be satisfied with that as the solution. I have used vlookup formulas and the index-match method and they both take about the same amount of time to update. I've separated each worksheet and used the "name manager" add-in and have searched all links for any type of error. I feel like I'm missing something. Is there a way to fix this "invalid reference" error so that I can edit my links with the source workbook open?

View 1 Replies View Related

Loop Cells In Column And Edit Data

Feb 17, 2009

I have several Excel files that I am about to change some data in, so I need to create an macro to speed it up. All sheets should be updated besides the last one.
The number of sheets differs between the files. The data that should be changed is in column C, starting at cell C10. But the number of rows differs. If the data in the cell begins with a Q, the Q should be removed, and if it doesn't begins with Q it should be skipped.

View 3 Replies View Related

SortSheets Macro For Statement Does Not Run Correctly

Jul 15, 2006

i have tried 2 different ways of sorting my worksheets in alphabetical order. Each time i try these it does something to all the sheets where it's not letting my For statement to run correctly. It was running correctly before I added the Sort Sheets macro. My workbook has a bunch of sheets for every agent and one summary sheet. The for statement looks in A1 for the condition. the condition is in every sheet except for the summary sheet.

Here is my For statement. Its was looking in A1 for the criteria before and working fine but for some reason it now is finding the criteria in the "summary" sheet when there criteria is not there?!?!

Sub run_it()
If Range("A8") <> "" Then
Range("A8").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.EntireRow.Delete
End If
Dim month As Integer
Dim month1 As String
month = InputBox("Enter the MONTH (Number) you are reporting")
If month = 1 Then
month1 = "January"
ElseIf month = 2 Then
month1 = "February"
ElseIf month = 3 Then .............

View 4 Replies View Related

Rightclick Macro If Cell Contents Formatted Correctly

Jan 16, 2009

I'm attempting to create something that can be used on any workbook open to automatically open a file based on the data in cell.

1) User right clicks on a cell.
2) If the cell's value matches an expected format (##-A-####-## for example), a macro is available in the rightclick popup menu.
3) The user selects the macro in the popup menu if they want to run it.
4) The macro takes the cell value and converts it into a filename.
5) The specified file is opened in an external program.

View 4 Replies View Related

Macro Request - If Macro Is Unable To Perform One Of Its Jobs Then Move Onto Next Line

Oct 3, 2012

I have a macro which refreshes a query when the spreadsheet is opened. This works fine when online.

However, if the user is not online, the query is unable to refresh and the macro just hangs.

Is there a code which will enable me to say " if unable to refresh then move on to the next line"?

here's the code below.

Private Sub Workbook_Open()
Sheets("Houselist").Activate
Selection.QueryTable.Refresh BackgroundQuery:=False
Sheets("Front").Select
Range("A1").Select
End Sub

View 2 Replies View Related

Unable To Run VLookup Macro Using VBA

Dec 23, 2013

I tried running the below VBA codes and received a Run-time error '424': Object required.

Sub 1
Dim i As Long
i = 1
'Do a vlookup between column a in test1 worksheet against column a:d range in test1source worksheet

[Code] .....

View 6 Replies View Related

Cannot Edit A Macro

Aug 15, 2007

When I list my macros using alt+F8 the edit option is no longer available, any ideas what I have done?

View 9 Replies View Related

Unable To Compare Dates Using Macro

Dec 22, 2013

Currently I am working on a Userform based Macro that reads date and time from user and compares it with the date and time present in a cell in excel sheet(in mm/dd/yy hh:mm format). If the date and time value entered in both places matches then it will fill green colour in the cell.

I tried to convert the date present in excel sheet into a string using Cstr but it is not working. I have attached the code below for your reference.

Dim lr As Long, i As Long
lr = Sheet5.Range("A" & Rows.Count).End(xlUp).Row
For i = 1 To lr
If Cells(i, "D") = "FIT" Then
If Left(Sheet5.Cells(i, 14), 1) = "M" Then

[code].....

View 3 Replies View Related

Unable To Share Macro As Add-in Or Template

May 4, 2007

I created a macro in VBA that pops up a calendar with keyboard short cut and places the date in selected cell. It works great on my pc. I can't share the macro with anyone. I saved it as an add-in...installing the add-in did nothing. Then I saved it as a template...the template did not open with any macros associated. both cases, no errors. no message to enable to disable macro.

View 4 Replies View Related

Edit Auto Add Macro

Feb 4, 2008

I have a macro that allows me to type numbers in cells and it auto adds to the previous value... what would be nice is if when i hit enter the cell focus stays at the current cell and doesnt move the next cell down... that way if i wanted to enter multiple values into one cell i wouldnt have to touch the arrow keys to get back to the cell

e.g: i enter a value into A1 and hit enter, instead of the box focus moving to A2, it stays at A1

Heres my current
Private Sub Worksheet_Change(ByVal Target As Range)

If Intersect(Target, Range("DATA")) Is Nothing Then Exit Sub
If Target.Cells.Count > 1 Then Exit Sub
If Not IsNumeric(Target.Value) Then Exit Sub
Application.EnableEvents = False
Target.Value = Target.Value + oldVal
Application.EnableEvents = True

End Sub

View 9 Replies View Related

Edit Macro To Not Delete Row

Mar 3, 2007

Sub Delete_0_Rows()
'Assumes the list has a heading.
Dim i As Integer
For i = Cells(65536, 1).End(xlUp).Row To 5 Step -1
If Cells(i, 1) = "0" Then
Range(Cells(i, 1), Cells(i, 1).Offset(-2, 0)).EntireRow.Delete
End If
Next
End Sub

I have data in the first 50 rows.
Then in row 51 it column A it starts 0's.
I run the macro, it deletes all the rows with 0's, and it deletes row 50 also some reason. I do not understand the above macro very good to edit it, and the fact it contains 5 1's doesnt help me lol

View 9 Replies View Related

Run Macro While In Edit Mode

Jul 24, 2007

I cannot run code from the formula bar.

I have a context sensitive menu

Sub AddContextMenu()
On Error Resume Next
Application. CommandBars("formula bar").FindControl(msoControlButton, 0, "MYMENU").Delete
On Error Goto 0
Dim objTemp As CommandBarButton
With Application.CommandBars("formula bar")
Set objTemp = .Controls.Add(msoControlButton, , , .Controls.Count + 1, True)
With objTemp
.Caption = "Formula Menu"
.BeginGroup = True
.OnAction = "TestMe"
.Tag = "MYMENU"
End With............

View 9 Replies View Related

Unable To Access RPT Files In Excel Macro

Dec 7, 2012

I am not able to access *.rpt files in excel macro

By using this below mentioned codes am not able to open the files from folder.

Code:
fpath = "C:Documents and Settings est"
f = Dir(fpath & "*.xls")
Workbooks.Open Filename:=fpath & f

View 4 Replies View Related

Macro To Edit Directly In Cell

Jun 18, 2009

I have disabled edit directly in cell in the option menu so that when i double click it goes to source file.

View 3 Replies View Related

Macro To Edit Text File

Dec 7, 2007

I was wondering if it was possible for a macro to edit a file by opening each .txt file, searching for the word "Reference", and then replace it with the word "Ref". Then save and close the text file.

There are no delimiters in the text files.

View 9 Replies View Related

Macro To Edit Date Within Formula

Jan 27, 2012

I have an array formula i use to sum data by specific criteria:

=SUM(IF(Input_Sheet!$A$2:$A$1000>
=DATEVALUE("01/04/2011"),IF(Input_Sheet!$A$2:$A$1000
=DATEVALUE("??/??/????")

So that it searches for any date and replaces with the new ones, but obviously the use of quotation marks with the wildcards makes this difficult in VBA.

How to link the cell values in with the "Replace with".

Code:

Sub findrep()
Dim target, cell As Range
Dim i As String
Dim k As String
i = "Input_Sheet!$A$2:$A$1000>=DATEVALUE("??/??/????")"

[Code]....

View 3 Replies View Related

Edit Macro For Column Width

Mar 19, 2012

How would my macro below be edited to keep the column sizes the same as they are in the original sheet?

Sub NewUploadFile()
Workbooks.Add
ThisWorkbook.Worksheets(3).Range("A2:K300").Copy
Range("A3").PasteSpecial Paste:=xlPasteValues
Range("A3").PasteSpecial Paste:=xlPasteFormats
Columns.AutoFit
End Sub

View 7 Replies View Related

Macro To Edit Error Bars?

Oct 29, 2012

how to control either the X or Y axis error bars for a scatter chart.

I'm building something like a gantt chart and I only want to use the X axis error bars and delete the Y axis bars. I've been able to add error bars by using "ActiveChart.SeriesCollection(1).HasErrorBars = True" but when i select the error bars using "ActiveChart.SeriesCollection(1).ErrorBars.Select" the Y axis (Vertical Error Bars) are automatically selected and any formatting I apply is added to the Y axis and left off of the X axis.

Does anyone know how to delete the Y axis error bars and/or choose only the X axis error bars?

View 5 Replies View Related

Edit / Expansion Of Sort Macro?

Apr 27, 2013

I've provided below a simplified version of the worksheets I'm trying to sort and the Macro I've recorded to sort the worksheet, however, I need to edit/update the macro for use on all the worksheets in the workbooks I'm sorting and specifically to REFINE the sort criteria for Column D and Column E.

The sort is run simultaneously and runs hierarchically A,B,D,E,F,G.

In column D I'd like the macro to sort numerically as it is doing but to IGNORE the prefix c. before the year when it occurs in the column.

In column E I'd like the macro to sort alphabetically as it is doing but to IGNORE any inverted commas: ' ' around the text as these are messing up the alphabetical sort for this column.

A
B
C
D
E
F
G

[Code]....

Below is the recorded Macro which I've called MANUAL_SORT2 this was recorded on a worksheet called BBCO with 103 rows in the column. I like the macro to be usable on all worksheets in the workbook also to add the worksheets all have varying numbers of rows!

Sub MANUAL_SORT2()
'
' MANUAL_SORT2 Macro
'
'
ActiveWorkbook.Worksheets("BBCO").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("BBCO").Sort.SortFields.Add Key:=Range("A2:A103"), _

[Code]....

View 1 Replies View Related

Macro To Edit Scatter Plot?

May 15, 2014

I have a list of interest rates and durations and was hoping to be able to add in a third dimension of data which would either increase the size of the plotted points or change their colour depending on the rating. So have the normal scatter plot then save me from editing each point manually.

i.e.

A1
B1
C1
D1

Interest Rate
Duration
Rating

3%
3.5
A+

[Code] .........

View 1 Replies View Related

Macro To Paste While In Edit Mode

Aug 18, 2008

Is it possible to write code to paste a string in text select (double click in a cell) mode rather than cell select (single click a cell) mode? I need a string to paste in as if someone had double clicked then hit paste (so as to utilize special delimiters.) Here is the code that reads the workbook, finds the next available row, then pastes:

Dim strCopyToLog As String
strCopyToLog = Range("Q2")
Range("Q2").Select
Selection.Copy
Range("b1.b5000").Find("").Select
ActiveCell.Value = strCopyToLog

View 2 Replies View Related

Edit Code From The Macro Recorder

Jul 25, 2006

The way i have been creating macros is by going to the tools menu.....macro....then..... record new macro.

I have a file which I have re-formatted using a macro as described above however because i receives files every month to do updates every time i open a new file and try to perform that same macro it either wont work or it wont format the correct rows.......is VBA the solution to this????

View 9 Replies View Related

Edit Macro When Macros Disabled

Oct 23, 2006

I accidently put the Application.Quit command in the wrong place. Now Excel closes immediately when the macro executes. I can get into Excel if I disable the macro, but then it won't let me edit the macro. Is there a way to edit my macro without executing it?

View 7 Replies View Related

Run Macro While In Cell Edit Mode

Dec 1, 2006

I have Form Button in Excel Sheet which Calculates by reading other excel sheet. Now the problem is when user enters data in a Cell by double Clicking on it and after entering data if he directly clicks on a button then Macro that needs to be invoked is NOT executed. The only way is that he needs to press EnterKey OR Click on any other Cell and then click on the button.

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved