Recorded Sorting Defines Set Range
Jul 14, 2006
I've noticed (a bit to late) that if you record with macro recorder a sorting statement that a range is captured. Because my files do vary in recordcounts, how can I sort indepently on the number of records.
View 4 Replies
ADVERTISEMENT
Jan 23, 2013
I have recorded a macro to sort a range of cell based on two values that is dependent on time in another cell. I now want the macro to run automatically when refreshing the workbook with F9, so as the time changes so will the sorting. Everything works fine except the sorting doesn't refresh when F9 is refreshed.
My recorded macro is:
VB:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim X As Long, FillCT As Long
For X = 1 To 4
If Cells(Rows.count, 1).End(xlUp).Offset(0, X - 1) <> "" Then FillCT = FillCT + 1
[Code] .....
View 4 Replies
View Related
Jun 1, 2014
I want to clean up this recorded macro but not sure how, it highlights duplicate values in a column
[Code].....
View 3 Replies
View Related
Jul 15, 2012
shortening the below recorded macro?
Code:
Sub Macro1()
'
' Macro1 Macro
[Code].....
View 3 Replies
View Related
May 28, 2014
I'm attempting to create a formula that'll sort a range of numbers and then return the corresponding values based on a specific place within the sorted range.
In this case, I'd like the following numbers sorted smallest to largest:
15, 9, 11, 19, 22, 17, 24, 19, 17, 24
The result would return something like:
9, 11, 15, 17, 17, 19, 19, 22, 24, 24
Then I'd like it to return the value based off of the formula in cell U13 & U14. In this case, it'd return the value in the 2nd and the 9th position (bolded above). I tried to use INDEX(), but it's returning the values in the unsorted list. I'd like it to return values from a sorted list. Also, I'm trying to solve this using a formula (not Sort & Filter) or VBA.
View 1 Replies
View Related
May 16, 2009
I have a values in column C of stuff1, stuff2 and on down.
I have a value in cell A1.
I want to start in C1, and every Nth, where N is the value in cell A1, select and paste into column H.
My problem is that the selected cells don't start in C1, in fact, based on the value in A1, it starts in different cells in column C. AND, if i press the button twice, the returned values are different.
View 14 Replies
View Related
Feb 20, 2013
I am trying to doctor a recorded sort macro to adapt to a changing range.
With the code below I get:
RunTime error 1004
Application-DEfined or Object-Defined error
I have tried with no luck:
Key:=dat
.SetRange dat
Key:=Range("A1").Resize(rw, clm)
.SetRange Range("A1").Resize(rw, clm)
Key:=Range("dat")
.SetRange Range("dat")
Key:=Range(dat)
.SetRange Range(dat)
[code]....
View 1 Replies
View Related
Nov 5, 2013
I am trying to sort a range of data by 1 column (column D), and get the following error:
"The sort reference is not valid. Make sure that its within the data you want to sort, and the first Sort By box isnt the same or blank."
Having googled and also checking some previous posts, I thought the issue may be around qualifying my key to ensure that I used the active sheet, but having done this, I still get the error.
CodeRange("A2:V2", Selection.End(xlDown)).Select
ActiveWorkbook.Worksheets("Overview").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Overview").Sort.SortFields.Add
[Code]....
View 3 Replies
View Related
Jan 10, 2008
I am using Excel 2003 and am after a macro that can sort a specific range of cells.
I have a spreadsheet that is used to record details of photos taken during bridge inspections.
•The details of the photos are recorded in column B
•The number of the digital photo is recorded in column C (the number of photos taken per inspection varies)
•After checking by someone else the photos are assigned a number in column A
After two blank rows that process is repeated for another inspection.
I am after a macro that when a cell within a range/block is selected it will sort columns A:C by the numerical order of the range block within column A.
For example when any cell is selected within the range A3:C7, that range and only that range will be sorted.
The same would happen when a cell is selected within range A11:C15, and so on....
View 9 Replies
View Related
Jan 9, 2006
I have some data recorded for every day for some subjects.
And the possible recorded value on each day is: 0 or 1 or 2 or 3 or 4 or null.
I have this type of data for number of subjects over many months.
My data looks like below.
Subjectnameyearmonth day1day2…………..day30day31
Name1990January 2044
Name1990February 31nullnull
Name1990March 2null31
So on.
I need to calculate the following 3 for each row.
1) On which day of the month first occurrence of the 4 comes?
This one I figured out using match() function which I paste below.
=MATCH(4,N2:AR2,0).
2) On which day of the month last occurrence of the 4 comes?
My data can not be sorted, and I couldn’t use match function here.
3) If there are any 4’s in a month, how many consecutive 4’s are there?
View 14 Replies
View Related
Oct 26, 2011
I have recorded the following macro and made few changes to it with my little VBA knowledge. But the code still looks very messy.
Code:
Application.ScreenUpdating = False
Sheets("Sheet2").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"FINDER;E:MacrosBSE Indices.iqy", Destination:=Range("A1"))
.Name = "BSE Indices"
.FieldNames = True
[Code] ..........
View 9 Replies
View Related
Jan 3, 2012
I run a golf handicapping system that utilises excel quite heavily to record a LOT data over the course of a season. In essence we have in excess of 50 players who play once or twice a week and I record their Stableford scores (dont worry that's a golfing phrase but it is basically how they performed that day) and adjust their golf handicap accordingly - all in XL.
So - a player may start the season with handicap of 20 but over the season this will vary up and down as each score is recorded. A player may well play in excess of 50 rounds in a season.
I currently record the player's starting handicap in one column and in the next column appears the freshly calculated new handicap after a new score has been entered. The column containing the new handicap overwrites the old handicap value each time it is recalculated.
All I want to do is to create a 3rd column that records the lowest handicap value attained during the season. So for each player I guess it should take the newly calculated handicap and decide if it is lowest it has 'seen' in that column and if it is record it.
View 9 Replies
View Related
Oct 2, 2006
I have recorded certain macros. But after executing macro 'Undo' do not work. How can I do it ?
View 3 Replies
View Related
Jul 9, 2009
example
1
2
3
1
2
6
4
3
6
7
In the Above range i want excel to show me
how many items are duplicate
If the duplicate item is shown i want the result to be shown in next cell
LIKE in the above example i want excel to show 1 is common , 6 is duplicated twice and therefore result should be shown in next cell
View 14 Replies
View Related
Jul 2, 2007
I have Excel 2003 with named cells, for example...
cell cell name data
A1 AAA 3
A2 BBB 1
A3 CCC 2
and so on...
When I autofilter (ascending) these cells, the data in these cells sort correctly, but the cell names stay where they're at.
cell cell name data
A1 AAA 1
A2 BBB 2
A3 CCC 3
I'm not an Excel expert so I'd like to know is there any way I could get the cell names to sort with their data.
cell cell name data
A1 BBB 1
A2 CCC 2
A3 AAA 3
View 6 Replies
View Related
Aug 7, 2008
I am making a timesheet which has a UserForm with textbox and 3 command buttons namely Search, IN and OUT. The program works like this, user type his id no., then clicks on search, once id match command buttons for IN and OUT are enabled. User clicks on IN button then current time which tags as NOW() will be pasted on the worksheet. Same goes with the OUT button. I was able to make them work that way. The problem here now is, the data being entered are vulnerable for data-re entry. What I mean is, if a certain user has already a recorded IN time, if he clicks on the IN time again, the data will be overwritten. Is there a way that once the user has already a recorded IN time, the IN button will be disabled for that user since he has already a recorded IN data?
View 14 Replies
View Related
Nov 13, 2008
I have been using the "record macro feature". What I want the macro to do is as follows.
1. cut all data from column C and paste it into G.
2. Use the textTocolumns feature to split a comma delimited string into 2 seperate columns.
3. user the textToColumns feature to remove any leading spaces from column G.
4. cut columns d-H and shift them left startign in column C.
I can do all of this find bu using the GUI while recording the macro but when I check the vb script it's completely missing the paste commands.
When I try and run the macro it, quite rightly, returns "run-time error '1004':No data was selected to parse.
Below is the resulting recorded macro.
How do I amend this macro do include pasting the cut data?
View 2 Replies
View Related
Sep 21, 2009
I recorded a macro (which worked), then tried to get more out of it by adding code to add a further function (which didn't work). The code is as follows:-
View 3 Replies
View Related
Aug 10, 2011
I have a workbook where I need to sort data with range (K2:L24), then move down 208 rows and sort range (K210:L232) and repeat this upto 1000 times. I have shortened a recorded macro as an example and would like to know how to loop or repeat.
Sub Macro2()
'
' Macro2 Macro
' Macro recorded 6/04/2011 by Greg
[Code].....
View 4 Replies
View Related
Dec 8, 2011
Below is a recorded macro i am trying to apply on a pivot table.
Code:
Range("F4:H4").Select
Range("H4").Activate
Selection.AutoFilter
ActiveSheet.Range("$G$4:$G$100000").AutoFilter Field:=1, Criteria1:="21", Operator:=xlTop10Items
The problem i am facing is that when i am trying to run it is not working.
View 9 Replies
View Related
Nov 18, 2013
I've recorded a macro in which I unhide certain columns, copy and paste some information then hide those columns again. The problem is that when the macro is finished, it incorrectly hides columns K to AN. I did not record that and it's not in the code so I'm lost as to why it's happening.
The macro is as follows :
Code:
Sub COPY()
'
' COPY Macro
'
'
Application.ScreenUpdating = False
Columns("K:BT").Select
Selection.EntireColumn.Hidden = False
Range("M5:N24").Select
Selection.COPY
[Code]...
Why it's hiding everything from K to AN. I've tried recording the macro several times but it's just not working, no matter the order in which I hide columns when recording it.
View 5 Replies
View Related
Dec 16, 2013
Find below the data sequence. 1st is the customer code, next are the date we have recd. the orders. In one excel command i want to find out the when was the order recd. date.
Code
17.11.2013
18.11.2013
19.11.2013
20.11.2013
11310
178
1235
1235
176
[Code] ......
If I give code and order qty then the formula should go to the code row and find out if any order of that qty had come if yes then date has to be returned as a result.
View 9 Replies
View Related
May 11, 2009
I have a list of items in Sheet1 column A (starting from row 1).
I would like the corresponding column B to have certain values depending on the value in column A (same row), as follows:
If the value in column A has "SYS????CZ", column B should be "HPC"
If the value in column A has "SYSNIS", column B should be "NIS"
If the value in column A has "SYSJBE", column B should be "JBE"
If the value in column A has "ICG????", column B should be "HPC"
If the value in column A has "IL????", column B should be "RUP"
If the value in column A has "SYSHPC08", column B should be "HPC"
What I tried was to record a macro while typing the formula in B1: ...
View 9 Replies
View Related
Aug 30, 2006
Im setting up a spreadsheet that does engineering calculations. Im using macros to run sizes from a standard schedule. It basically takes the values from one sheet (schedule) to another (calculation), then the result from the calculation sheet (Value only, not the link) is pasted back into the schedule. The macro seems very bulky and im sure that it can be made more efficient with a loop. here is a sample of the code from the macro;
Sheets("Calc sheet").Select
Range("C6").Select
ActiveCell.FormulaR1C1 = "=Schedule!R[1]C"
Range("C7").Select
ActiveCell.FormulaR1C1 = "=Schedule!RC[1]"
Range("C8").Select
ActiveCell.FormulaR1C1 = "=Schedule!R[-1]C[2]"
Range("C9").Select
Sheets("Schedule").Select
Range("G7").Select..................
View 3 Replies
View Related
May 30, 2008
I manually create a pivot table (and record my actions) the pivot table references all of the information in my data range (70k+ lines). When I run the recorded macro the new pivot table limits the data range to the first 65536 lines (the old limit)....
View 6 Replies
View Related
May 30, 2014
I have some data formatted as a table. There are some blank rows at the end that still contain formula.
Every time I sort the data these rows move to the beginning. I have tried only selecting the active rows of data, but the whole lot defaults in each time
How do I sort data with a selected range only (within a table)?
Don't really want a macro as this will need to be used by others
View 1 Replies
View Related
Jul 31, 2014
I have a spreadsheet with column headers like, "Date" "Phone number" "Name" ect., and rows of data below. Each of these rows contains data pertaining to a prospect employee, as the purpose of the spreadsheet is to keep track of job applicants. One column is used as a 'Recruiter Sign-off' area, where the recruiter who processed the application inputs their name:
Example.png
I'm trying to automate a variation of excels sort function. However, I don't want to sort 'From A to Z.' Instead, I want to have the rows of data sorted with the 'Recruiter Sign-off' column used as the sort Key, and a selected name (of one of the recruiters) used as the sort Criteria.
I already have a userform that allows the user to select a name from a listbox. When they press confirm, the name is stored in a Public String variable, (selectedRecruiter). I'd like then like to have the rows below the column headers to be sorted based on the selected name. Example: User selects the name "Jon" from a list. The application then brings all of the applicants that 'Jon' has signed off on (those rows that contain his name) to the top rows of the range.
The workbook is shared, so I cannot use tables.
I found a code that accomplished what I want, however it also leads to a horrible system crash after a few times running it (BEX crash).
[Code] ..........
View 3 Replies
View Related
Sep 21, 2009
On column A, I simply do an A-Z sort that gives the expected result. So I recorded it as a macro. In column G is a code that corresponds with column A. When the marcro is executed Column A is sorted but the corresponding value in G stays where it is. Clicking the A-Z button works. But when that action is recorded as a macro I get the above quirck. Since VBA is not my beef, I don't really know what wrong.
View 4 Replies
View Related
Oct 12, 2012
I have following macro recorded to extract data from a mainframe system
open "C:DesktopReportRBDRBD.txt" for OUTPUT as #1
rc% = ps.sendstring("{clear}")
rc% = ps.sendstring("a24octdelbom*9w{enter}")
test1 = PS.getdata(450,3,27)
print #1,test1
The requirement here is run the above macro for the next 30 days automatically, for example
rc% = ps.sendstring("{clear}")
rc% = ps.sendstring("a25octdelbom*9w{enter}")
test1 = PS.getdata(450,3,27)
print #1,test1
and so on till 23 Nov. From the start date the macro should run for the next 30 days. Currently i am changing the dates manually in the macro
View 7 Replies
View Related
Apr 22, 2013
I have a button with a macro assigned. The macro needs to create a new worksheet at the end of the workbook, rename the new sheet to "New County", make the cell size match the rest of the workbook, and then paste in a template from another sheet called "Master".
I recorded a macro that does this, but it has a static reference to the new sheet instead of what ever the new sheet is. So the Macro works one time, but never again. I'm sure this is an easy fix, and perhaps there is a much easier way to do this, but my limited VBA knowledge is hampering me.
Code:
Sub AddNewCounty()
'
' AddNewCounty Macro
' Adds a new County sheet to the workbook.
'
'
[Code]...
View 9 Replies
View Related