Inverting Range (top To Bottom) In Same Location
Apr 11, 2012I am in need if inverting a Range (top to bottom), in the same location, like this ....
1 2 3
4 5 6
7 8 9
to...
7 8 9
4 5 6
1 2 3
How would this be done ?
I am in need if inverting a Range (top to bottom), in the same location, like this ....
1 2 3
4 5 6
7 8 9
to...
7 8 9
4 5 6
1 2 3
How would this be done ?
I have a range, for e.g:
A B
7 apple
6 banana
5 kiwi
4 grape
3 litchi
Now I'm summarizing the data from several spreadsheets which have ranges like this, and the ranges are huge!
Easiest thing, is to copy and paste - which is what I'm doing. Only I want to do it in a logical order, i.e. the top of column "A" would be 1, below that 2, etc up to in the example 7. And of course column "B" would correspond to the right number.
My question, is there a quick way to "invert" the other spreadsheets so that the data is in the numerical order I want?? What I'm doing now is copying one row at a time and pasting it in the right order which is taking too much time. If I could "invert" either my sheet or the others, then I could copy an entire range and just paste in one go.
Is it possible to invert a selection? I have a heap of data that is scattered all over the place and I can to a Search and Find All to locate the data I want but I want to get rid of everything else, so can I invert the selection some how?
View 9 Replies View RelatedI'm looking to invert a column of data that has no specific sorting quality. Is there a simple way to flip data in a column.
View 2 Replies View RelatedI tend to use a lot of For Each loops when I want to go through a range looking for something but this time I'm not so sure it will work.
I have 9 databases each containing over 400 rows with different pieces of client information, these databases are shared between around 40 people (I've also used the 'Allow users to edit ranges' utility to restrict access). What this means however is that the users cannot delete an entire row, instead they can only 'clear contents' on individual cells. This is fine until I try to generate statistics from the databases using autofilters which stop at the first blank row.
So I need to write a backwards for each statement that starts at the bottom and deletes all the blank rows on the way up to the top. I've tried similar things to this before using the For Each but when you use it to delete a row it sometimes skips the next row as it continues at the next one.
I've not managed to get it to work before, I'm just looking for a little guidance really as to how to do this correctly.
VB:
For TopRow = 1 To BottomRow = Range("A1").SpecialCells(xlCellTypeLastCell).Row Step -1
'If is blank delete row.....
Next
How can I determine what the bottom row is in a range in VBA? I have an SheetChange event sub that takes in Target as Range. I want to know what the first/last row/column is in the Range. So, for example, say the Sheet has values in A1:B5 and I paste over A1:B4. Target will be A1:B4. I need a method that returns 4. I tried Target.End(xldown).row, but that gives me 5 (since theres data in A5).
View 4 Replies View RelatedI've recorded a macro that selects a bunch of cells so I can work with them. However, it's hard-coded to the bottom cell of H1551, and I need it to work no matter how large the range is.
Code:
''' Concatenate column H with B & F
Application.Goto Reference:="R2C8"
ActiveCell.FormulaR1C1 = "=CONCATENATE(RC[-6],"" "",RC[-2])"
[Code]....
I now have everything set up to do exactly what I want except this last bit.
All I want is for the overview page to show the top three referrers for each month. At the moment, it's finding the top and bottom 'scorer' but if more than one has the same score I can only see the first alphabetically.
2012PlayerStats.sample1.xlsx
I have a list of players and the team they play for in Columns A and B.
In column E I have created a list of only unique names and in F I need the Team the played for last. However with Vlookup I am only getting the team they played for first. How can I get the team they played for last?
I have tried vlookup and index/match and get the same.
The following code is doing what I want it to do in part, its copying the data in range k3 to q3 to the next empty row in columns a to f
It works when I change any cell in column K (11), I want to change to only on a change in K7 or K8? As an afterthought if I'm dealing with the same sheet do I need to make reference to sheet2?
VB:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim nextRow As Long
If Target.Column = 11 And Target.Cells.Count = 1 Then
[Code].....
I have a s/s encompassing over 350,000 rows.
Data consists of a series of ranges from columns A:N and rows varying in number between 3 and 30.
There are two blank lines between each range of data.
Each range is (with exception) numerically ordered down column H (e.g, 1, 2, 3, etc).
Problem: there are around 1100 occasions when a range contains a row of data which is to be disqualified from consideration. On these occasions the data always appears in the top row of the range and is identifiable in column H by the nine codes 111, 222, 333, 444, 555, 666, 777, 888, and 999).
I wish to find a macro which will :
1. where the top row of a range in column H is one of the codes 111 to 999, transfer that row of data to the bottom of the range.
2. delete the now empty top row from which the transfer was made from.
3. insert a new blank row at the bottom of the range below the row which the data was transferred to (in order to maintain the two blank rows above and below each range).
I was wondering if there was a way to create a two cell dynamic range that doesn't expand, but instead shifts.
The cells that I'm interested in are always at the bottom of the column of data. For example, the first two cells I want as my range are C13 and D13. Then, for my next use of the range, I would like it to include C14 and D14.
I am trying to find a code that will simply find the last cell in Column A of a named Range (titled: ConditionlFormatArea)?
Also IF I could get a line(s) of code that would just find the last cell in Column A of the Used Area.
I ask for both because I am not yet certain which line of code will work best for me.
When I have that cell located I need to Remove the Conditional Formatting. I think I can get the code for that part.
I have a spreadsheet which is going to be populated everyday from figures from another spreadsheet using autofilters and the very useful SubTotal worksheet function. I'll attach a copy of the work in progress, also there will be a macro in here which Everytime the user presses update, it copies a range of cells and formatting and pastes it to the next available cell on the right. I've also drawn the movement of the cells i'd like The reason being, is that its going to give day to day, up to date figures from a datasheet.
The problem i have is that when i come to populate the grid which has been copied, i need a calculations to populate each cell in the Less<1week column, then when it gets to the bottom, move Back to the top, and accross to the right 1, and then populate down again, and so on until the end of the grid in question, i dont think i can use a for/next loop becuase it will be a different column address everytime. I dont really like loops, but i feel this needs it.
Is there any easy way to identify the bottom left cell in a named range?
View 6 Replies View RelatedBasically, I am trying to write a program that will index match through a range and if it doesn't find the value that it is matching to, it will add the value to the bottom of the range it is indexing against. In other words:
My C column has a list of CUSIPS. In column J, I would like for the User to be able to add a list of cusips and then have the ones that don't already exist in the list of CUSIPS in column C be added at the bottom of the range. I have written a macro now that uses the index match, but for some reason it adds all of the cusips that exist in J range to column C, not just the ones that are missing. I can provide a template if necessary.
Sub Filler()
Dim Row As Variant
Dim NumberOfRows As Long
Row = 0
[Code]...
A1 cell: 9
A2 cell: 6
A3 cell: 2
A4 cell: 4
i want to know location number of min value in range[A1:A4].
the result: 3
I have an issue with the below code:
VB:
LastRow1 = ActiveSheet.UsedRange.Rows.count
ActiveSheet.Range("R1:R" & LastRow1).FormulaR1C1 = _
"=IF(RC[-1]<>"""",HLOOKUP(RC[-1],Sheet2!R60:R61,2,FALSE),"""")"
The issue I have is that in sheet2 the HLOOKUP range i want to lookup will not always be in R60:R61 these rows vary depending on the amount of data above this range... is there a way of incorporating some sort of
VB : LastRow = ActiveSheet.Range("B" & Rows.count).End(xlUp).row + 1
To locate the bottom of the data and the start of the HLOOKUP range?? if is there some way of re-coding it?
I often need to save the user's current position on a worksheet, do some stuff then get them back to where they started. In the past I've saved the current location sometimes as a string and sometimes as a range.
Code:
Sub BackToRange()
Dim BackToHere As Range
Set BackToHere = Selection
' do stuff
BackToHere.Select
End Sub
Code:
Sub BackToString()
Dim BackToHere As String
BackToHere = Selection.Address
' do stuff
Range(BackToHere).Select
End Sub
Each row contains a series of values which are not sequential.
For each row I want a formula which gives me the location (i.e. column 10) within that range of the first negative value, searching from left to right.
I am trying to develop a spreadsheet that will calculate a cost based on a matrix. I am attaching a sample of the calculation created so far. The end result is in cell M13 and is highlighted in yellow. I kind of layed the formula out in a few different cells, so hopefully it would be easy to follow.
simplify this process with maybe another formula that I might not be aware of, or maybe show me how to get this done in VB code. I think VB code would be the correct way to go just not sure.
I just used the excellent formula =row(index(range,match(1,index,--(range)>0),0),0))) to give me the first instance of a number, but i am wondering if there is a formula to give me the last instance of the number as well? Maybe? This would save me much time if possible.
View 11 Replies View RelatedI would appreciate some ones help to correct a macro I'm trying to write. The macro copies 3 columns from Sheet1 to Sheet2 in a selected location. The 3rd column copied needs to be pasted in a different column in Sheet2.
View 6 Replies View Relatedcopy range of data from "sheet1" to sheets named A-Z i.e A,B,C,D,E..... in the same location as it was on sheet1 e.g. if on sheet1 data was in B1:C10. i want to copy this onto the sheets named from A to Z in the lacation.
View 9 Replies View RelatedI'm trying to select a range of cells whereby the range is dependent on the currently active cell. I know you can use the "Activesheet.Range("A1:D2").select" method to select a range where the cells are always the same, but I'm after a dynamic selection where the values can be programmatically altered depending on some other result.
For example, let's say that I make a certain cell active (based on the result of some other formula), and I want to select the range of cells in the adjacent column that is X rows deep. Putting this into context, imagine the resultant active cell is B2, I then want to select the range C2:C10, but if the active cell is E10, the range selected would be F10:F18 (if active cell is X, then range would be Y:Z).
The Offset function would allow me to position the cell based on the current active one, but it doesn't let me select a range. The Range function only lets you choose either hard coded or index cells, e.g. "Range(cells(y,z), cells(y,z)).select", but this is still no good because I'd need to know the index value of the active cell (can this be done?).
I have recorded the below macro and I am not very happy with it. enhance the macro and add the following:
I need to copy the range "ROW" and past it below the range "MENU". Also the range "ROW" (ROW = copy of 3 line with some cells merged) is hidden.
I need to unhide and hide back the rang ROW. Right know I have to leave the range appearing otherwise my macro doesn't work.
HTML Code:
Sub ADD()
' ActiveWindow.LargeScroll Down:=2
Range("ROW").Select
Range("ROW").Activate
Application.CutCopyMode = False
Selection.Copy
' ActiveWindow.LargeScroll Down:=-2
Rows("7:7").Select
Selection.Insert Shift:=xlDown
Range("A7:A9").Select
End Sub
(I am using Excel version 14.0.7106 and MS Office Professional 2010.)
I have a macro in which I have named a range of numbers in a spreadsheet, used the "find" function to find a particular number in that range, and now would like to copy some information into a cell in the same row as the found number. However, when I try to move over to the cell that I'm copying to, it only goes to the 1st row in the range that I have defined.
Here's the portion of code I think you need to see. Everything works...it finds a match...but then I don't know what to do from there to get the information to the correct row:
'Grab the 1st project number
Range("C8").Select
Do Until ActiveCell.Value = ""
If ActiveCell.Value "" Then
prjnum = ActiveCell.Value
Selection.Offset(0, 8).Select
[Code] ..............
I'm trying to create a new report and looking to get the top and bottom ten from a list. My original idea was to use the LARGE and SMALL funcions. However, when I use those because some values may be the same, the corresponding lookup values would be incorrect.
If I have Vendor A,B,C
VendorA 100%
VendorB 100%
VendorC 98%
My report would read this:
VendorA 100%
VendorA 100%
VendorC 98%
I'm using INDEX with MATCH to bring back the vendor. I then figured, I could just link the cell to the top 10 cells from where I am pulling from, which wrks for top ten, but won't work for the bottom ten.
I'm pulling the the data from a sheet with a query so I won't know where the ending data is unlike where the starting data begins. I then thought that maybe I could use an option button to control the query and just change the sort order. But, I really don't want to use VBA on this report, which I think I would have to do for that idea to work.
I need a formula that will give me the bottom most value that is filled in a cell in a certain column.
View 9 Replies View RelatedI am needing to do a formula based on a range of data that will return the top third middle third and bottom third.
Example Data
W X Y
Gross Gross
Margin Margin% Rank
51,241 36.46%2
25,584 19.56%20
19,914 16.26%40
17,188 14.27%52
19,167 15.55%43
6,828 5.23%84
48,076 29.17%3
18,282 13.78%47
16,896 12.75%58
16,124 12.14%64
16,549 12.27%59....................
I first need it to look in the rank column for highest number and divide by 3
Then I need it to give me the average Gross Margin if rank is between 1-32, 33-64, 65-95
I have this for the top and bottom but can't get the mid range to work(except it doesn't automatically calculate)
SUMIF($Y$8:$Y$102,"<33",$W$8:$W$102)/32
I have tried averageif....
Using rank to calculate this may not be the most efficent way