Sort Alphabetic With VBA On Range Till Last Row?
May 13, 2014I am running a formatting excel, and I will also need to select from cell P30 till last row, then sort alphabetically by moving the other rows data too.
View 3 RepliesI am running a formatting excel, and I will also need to select from cell P30 till last row, then sort alphabetically by moving the other rows data too.
View 3 Replies in column A i have Customer's Names in column B Customer's Surnamas
Col:ACol:B
MikeConroy
JohnSmith
SimonConroy
DaveMont
BradOrton
BradOrton
MikaDavidson
MikaDavidson
ValeAndersone
KenjiIgawa
AsenAdkins
SimonConroy
i need to sort Customer's Names by alphabetic order without repeating in a line
AsenAdkins
BradOrton
DaveMont
JohnSmith
KenjiIgawa
MikaDavidson
Simon Conroy
ValeAndersone
BradOrton
MikaDavidson
Simon Conroy
MikeConroy
I have got a spreadsheet with a database of people and all their details, Surname (E), Name (F), Gender (L), Date of Birth (M), Age (O), etc...
So I have a demographics sheet that I calculate ages, gender etc and would like to do the following 2 tables.
1. Working out ages between 2 specified ages that I input into set cells. E.g. I want all people between the ages of 13 and 18 years old (So i put 13 into cell A13 and 18 into B13. My formula will then sit in C13 and will Also count those ages. I want to do this so to be able to change the ages if needed
2. Working out Surnames that sit between an alphabetic range. So as I did with ages I can have "A" into A51 and "D" in B51 and it will give me all the surnames that start with those letters in a range between A and D (Including the 2 options I have in those cells).
If Cell "B55" Cell is selected and I want to Select all the above rows to select till Row 1. Selected Row mught change Say B66 or B82 (Dynamic)
Whatever may be the Cell Selected, The result should be The above rows should get seleted. So that I want to delete the rows easily
HTML Code:
ws.Range("B55").Select
Range(ActiveCell, Activecell.Offset(-55,15)).Select
'This cannot work if the selected Cell is 65, So this should be Dynamic till above Range 1)
I've normally just dynamically selected a range using the xldown feature but because this row contains formula it goes always down to the bottom of the formula instead of the last cell which isn't blank.
How would i go about generating this dynamic range that stops at the first cell that contains no value (but has a formula)? Perhaps a do while loop which looped down until it hit the first blank and then assigned the cells it had looped through as the range?
The problem is sorting alphabetic.
I want to get the Alphabetic Name for a Column No to be used further. Lets say I type 5 in cell A2 then in B2 I would get the Alphabetic Name - E
View 4 Replies View RelatedI would like to ask if it is possible to sort a range of row? What I mean is, if I sort like Row 1, the entire block of row 1 will move as well? Like if i have column A to F, then row 1 of column A to F will move together at the same time.
View 3 Replies View RelatedI am running a macro where I pass it starting column and it processes the next 10 columns. How can I pass it "J" and have it increment K,L,M,N,O,P,...?
View 3 Replies View Relatedhow do I sort data with a cell... attached is some of the data im using
View 2 Replies View RelatedA string contain a number like AB12345 or B7845 How could I remove the alphabetic characters and keep only the number.
View 2 Replies View Relatedx = InputBox("Please Enter the Loan Amount:")
If x < 0 Then MsgBox ("please enter a loan amount greater than 0.")
but then how do I bring up the input box again until it is filled in correctly?
I tried Do until a few times but made a mess of it, I also need to disallow alphabetic and symbol characters.
I need to create a list of all possible permetations of all 26 alpha characters when put into a 3 character string. EG: AAA, AAB, AAC, through to ZZZ. Is this something that can be done in excel/vba?
View 4 Replies View RelatedI was just recently forced to create my first UDF and after how well it worked I now am very interested in learning more. I am trying to create a function to sort a range by the values in a specific column and return the range. I know this should be really simple but for some reason my code dies whenever it gets to my inner-most loop. I need to use this in a larger function but for now this is my only question. I did find that Excel 2007 has built in Functions for this but my company still uses 2003.
My
Public Function SortRange(rngToSort As Range, valCol As Integer)
Dim Swapper As Variant
Dim i As Integer, _
j As Integer, _
k As Integer
For i = 1 To rngToSort.Rows.Count
For j = 1 To rngToSort.Rows.Count - i
If rngToSort(j + 1, valCol) < rngToSort(j, valCol) Then
For k = 1 To rngToSort.Columns.Count
Swapper = rngToSort(j, k)
rngToSort(j, k) = rngToSort(j + 1, k)
rngToSort(j + 1, k) = Swapper
Next k
End If
Next j
Next i
SortRange = rngToSort
End Function
Im sorting a dynamic range as mentioned in this Sorting a Named Range. My range is called drWarningTypes and is defined as:
=OFFSET(DataSource!$A$2,0,0, COUNTA(DataSource!$A:$A)-1,1)
When there is only one cell in the range, then running the following sort function includes A1 also in the search (and also adjoining columns).....
I am trying to add up the same item until it changes. I have attached the file with the desired outcome in the 2nd column.
View 1 Replies View RelatedHow would one go about creating a macro that would sum values in column G based on a condition in F ( a "SUMIF" basically) until the end of the range?
The condition would be so that the first blank cell in Column G (starting from column G9 ie Range("G9").End(xlDown).Offset(1,0) would contain the sum of everything above up until the word "Total" (or even the string of 5 characters from the left say "Total") appear in Column F - (the word Total appears a few times in column F, so it should detect the first applicable one)
The idea would be to have this repeated / looped until the end of the data range
Attached is an example and I hope what I have written makes sense
As for the worksheets:
"Final" is what it should look like (Blue Cells represent manual calculations)
"Working" Sheet is where I have it up to now
The sheet "Original" has a button that recreates everything up until where "Working" Sheet is
Sheet ("Tenant History Schedule") is scrap sheet
I have a spreadsheet with a varying number of columns with data.
Now I like to copy the header over it till the last column that contains data.
If I used the recorded VBA the range is stated in letters (In the sample below column K but this can be any column).
What is the best way to code it in such a way that one gets the headers till the last column used?
Range("A1:B1").Select
Selection.AutoFill Destination:=Range("A1:K1"), Type:=xlFillDefault
Can I have a macro code to insert a row from column A:K.
I have data in column L to IV which I want to stay as it is. i.e. for example when a row is inserted from A:K, that row should not extend beyond Column K.
I have a problem with a very simple Lookup (please see attached). When I copy/drag down the dropdowns in column A and the Lookup formula in column B, the lookup up does not recognise the value in column A till I save the sheet. The same if I select a different value from the dropdown i.e. the lookup only works when I save the sheet. Am using the wrong Function to do this or it something else.
View 3 Replies View RelatedI need help on Excel 2007 Macro , the below coding searches for a string "recvtiming" in a cell as a wildcard and delete it entire row once it founds it in a single active sheet.
Question,
1. How do I manipulate it to search for the same string and upon finding
a) Delete its cell content and all the contents from its right hand of side till its last column which have a value from the same row on all 50 sheets in the workbook.
e.g
a b c d recv 0 1 2 3 4
It should return,
a b c d
I've uploaded my spreadsheet. I asked my professor if our formula had to take into account whether or not our payment would be changing. As long as I calculated the initial amount - which worked out to be around 30 dollars, I could assume I paid that amount for the entirety.
ASSIGNMENT 4
My latest Mastercard statement shows a balance due of $1,696.96.
Based on recent bills, assume that the minimum payment amount is computed as follows
(balance_owed)*(annual_interest_rate/12) * 2, then rounded to the nearest whole dollar amount.
The minimum payment amount is the amount calculated above or $25.00, whichever is the greater amount.
The annual interest rate for purchases is 11.24%. If I make no more purchases and always pay my bill on time how many years and months will it take be pay it off at the current minimum payment amount each month?
How much total interest would I pay if I repay the loan this way?
What fixed monthly payment amount would pay off the debt in 2 years?
Assume monthly compounding of interest. All calculations are to be done in the Excel worksheet.
The functions NPER() and PMT() will be useful. Note that either the Present Value or Payment amount should be negative (not both) because of conventions concerning the direction of cash flow."
If a cell contains a birthdate, how do I count the number of days till the next birthday? The date is entered, as an example "1/1/2013".
View 5 Replies View RelatedI want to combine row while address row not complete. I attach example xls file in this post.
View 3 Replies View Relatedworkhorse.xlsx
This is part of the bigger excel sheet. I would like to write a macro to find the column D6 based on the location of text 'committed total' . Then addup all numbers from E6 to V6 and write total in W6. Then add d6 and w6 and place it in X6.
I need a formula to sum all E3 cells starting from sheet "Joe" to the last sheet i have, without being obliged to modify the formula for each new sheet i create and which by default is created in the end. something like:
=sum(Joe:my last sheet created!E3)
Also,do protected cells in some of the sheets affect this formula calculation?
can i use the countif question to make it count till a particular row based on the value . for instance if i want the countif till value 45 is met i.e i want countif to count till the row where 45 value is housed
VALUES 40404540403047
I have a control chart macro which is being used for patient doses of a medication. Right now my macro automatically fills columns D-N down to row 100. However, I would like it to stop at the last row of data entered in column A. I have attached the code related to the formulae a
J
Sub Control_Chart_1()
'
' Control_Chart_1 Macro
[Code]....
I try to do something like this
VB:
Sub autofill()
Range("A1").Select
Selection.autofill Destination:=Range("A1:A1048576 "), Type:=xlFillDefault
End Sub
but i need to select first cell in every 20th column and then execute autofill till the last row that excel provides. I can only do this manually but I have for now 125 columns to fill or to write some monstrous code. Unfortunately I do not have the knowledge to do this in a smart way and I guess there is an elegant way to solve this problem.
I am using this code and it works fine:
Dim MyData As Range
Dim MyResult As Range
Set MyData = Range("E1:E1000000")
Set MyData2 = Range("F1:F1000000")
Set MyResult = Range("J4")
MyResult.Select
Selection.Formula = "=COUNTIFS(" & MyData.Address & ",""=Kim""," & MyData2.Address & ",""=done"" )"
Is there any way I can change the code so that it automatically finds the last cell as Im using Range("E1:E1000000") and Range("F1:F1000000") because there will not be more than 1000000 entries.