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


ADVERTISEMENT

Expansion Of FIND Function

Jan 30, 2014

I want the create the following summation function (probably with the use of FIND).

You have 3 columns:
- Column A containing values; a, b, c, d, e
- Column B containing values: 1, 2, 3
- Column C containing ad randum values f.e. lengths

I want the achieve a summation of the lenghts with the following conditions 'a' in column A AND '1'in column B.

Apart of this a summation of the lengths with the conditions 'a' in A AND '2' in B.

[Code]....

View 2 Replies View Related

Macro To Sort Colums And Protect After Sort

Nov 5, 2009

I am looking for a macro to sort my colums in ascending order the range i need sorted is from A7:F107, it will be sorted with the numbers in the A column ie 1 - 107. sometimes different numbers get added and it has to be sorted in number sequence.

If possible i would also like a macro to protect this range after the sort,

View 3 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

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

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

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

Rum Macro While Cell In Edit Mode

Oct 19, 2007

I have users who don't press Enter (or move to a new cell) after entering text. They then try to click a form button - and of course - the macro does not run.

Is there an xl/vba solution to force them out of edit mode before clicking the button?

View 6 Replies View Related

Run Macro While In Cell Edit Mode ..

Apr 3, 2008

In an Excel worksheet all command buttons are disabled while a cell is in edit mode or while the cursor is active in the formula bar. Is there a way in VBA to save the cell's contents and execute a command button if clicked while a cell is in edit mode?

View 2 Replies View Related

Macro To Edit Userform In Other Workbook

Apr 23, 2008

I'm writing a macro that opens another Excel file, opens a userform within that file, and manipulates the data. I've never tried to do this before. I keep getting "Object Required" error. My macro fails on the "frmMain.Show" where "frmMain" is the userform I am interested in. Here's the


Excel.Application.Workbooks.Open ("C:DataCalculations.xls") 'Open file
frmMain.Show 'Bring-up UserForm
frmMain.cbUser.Value = "Guest" 'Sign as Guest
frmMain.cbVariables.Value = var 'number of variables

View 3 Replies View Related

Macro To Edit Multiple Rows Of Text

Oct 22, 2007

I used the macro editor to create a "simple" macro to edit 7 rows of text. The steps were basic and simple - F2 key, backspace about 25 times, and down arrow then repeat these 3 steps 6 more times. The macro I got gave me the result of the very first cell as I was recording the macro. I think I remember the old Lotus 1-2-3 macro text - {edit}{backspace}{down}. Wish it were still that simple.

View 5 Replies View Related

Allow User To Edit Cell Contents Within Macro

Feb 4, 2014

I need to query a column and find the cells that have been incorrectly coded. For example the coding standard is #<reference number>/. Sometimes people forget the "/". It is not as easy as using search and replace because the string may have more contents than the above.

For example it may show: ATM/45678/#789876 dt. 1-2-14/ or it something like CHQ/44384/#78987600.

There are many permutations. So I need to find the cells that don't have a "/" following the #<reference number>, then allow a user to enter the slash. At this stage, I don't need code to find cells containing errors, I think I can figure that out. I do need to know how to allow the user to edit the cell as part of the macro. Once the user corrects the error, the macro should then continue. Is this possible?

View 2 Replies View Related

Edit Email Macro - Lotus Notes

Nov 8, 2007

I have a macro that sends a custom email through lotus notes. It works, but will only generate 1 email instead of looping through my list. If I have "next r" at end I get email of 1st record. If I put "next r" before "On Error GoTo Audi"

I get last recorded emailed but not 1st 2. I don't know how to get it to send all. It seems the for next loop is jacked up.

For you to see macro work you need to have lotus notes and put email address in column B.

test file is attached.

View 10 Replies View Related

Edit Checking Before Running Macro (with Message Box)

Jan 22, 2010

I'm trying to control the number of ways people can mess-up this worksheet. I have several buttons that copy one object from a worksheet "FISH PARTS" and paste them onto another "THE JUMPER FISHBONE"

My question is can I prevent people from copying objects from the first worksheet if they already exist on the second? Specific to the code below: how do I make sure "BONE_1" doesn't already exist on the worksheet "THE JUMPER FISHBONE" before allowing it to be copied from the other worksheet. And can I generate a message box that tells the user the object already exists on the page.

View 2 Replies View Related

Allow User To Edit Worksheet At Certain Point During Macro

Aug 17, 2011

I have a macro that I would like to let a user edit the worksheet and make changes at a certain point. I have tried creating a modeless userform, but the userform only pops up and the code continues running without waiting for input (or running any of the code in the userform). Any way I can accomplish this or what I would be doing wrong with the userform?

View 7 Replies View Related

Macro To Open New Files And Edit Links

May 12, 2014

I'm trying to set up a macro so that: in column C I will see the current (old) links being used by the workbookin column D I will input the new links I want to use in the workbookthe macro will open all those files in column Dthe macro will then replace the current (old) links with those listed in column D

I have the following so far, but something doesn't seem to be working - it gets as far as opening the first new file but doesn't open any others and doesn't change any links (although I've tested the part to change links separately and this seemed to work ok).

Sub linked_sheets()
Dim LinkedBooks As Variant
Dim i As Long
LinkedBooks = ThisWorkbook.LinkSources()
For i = LBound(LinkedBooks) To UBound(LinkedBooks)
Cells(i + 3, 3) = LinkedBooks(i)

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

View 1 Replies View Related

How To Create A Macro To Edit Cell Content

Nov 9, 2007

I'm trying to create a macro which will edit the content of a cell and update. I'm just using the "Record New Macro" option in tools.

It doesn't seem to perform the F2 edit function within the macro.

I'm sure this has been discussed previously, but I can't get the search function to work for me.

View 9 Replies View Related

Code To Edit Macro Security Settings

Apr 1, 2008

I need a code to change the Macro security settings of the computer where the file is opened to enable macros.

View 9 Replies View Related

Macro For Copying Formulas & Edit In New Cell

May 17, 2009

I need to be able to copy a formula from a row that is 180 rows before the current cell.

I then need to edit the formula so that the rows all start at 6. then i need to change the column references.

The formula that I am editing looks like this after it has been copied from before:

=IF('Entry Form Portrait'!$d870="m",IF('Entry Form Portrait'!$n870="a",'Entry Form Portrait'!$a870,""),"")

So I need d870 to be changed to d6, the n870 to be changed to o6 (current column +1), the a870 to be changed to a6.

Then this resultant formula to be copied to the next column and a6 changed to b6, then copied to next column again and b6 changed to f6.

Then all 3 columns to be copied (or autofilled) down 105 rows.

I tried to do it by recording the macro, however it only works for the first time that i use it, and then just keeps repeating in the same place. I need it to use the cell i have selected as the starting point.

View 9 Replies View Related

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 View Related







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