Swap Ranges On A Worksheet
Nov 29, 2007
Right now I have 2 ranges say A and B. Range A is in a worksheet on row 7 and range B is on the same worksheet row 8. What I want to do is make it so that range B gets pasted in for range A and vice versa so that range A in now in row 8 and range B is in row 7.
View 2 Replies
ADVERTISEMENT
Aug 10, 2007
I have a huge xls of names setup as Last Name, First Name in a single column.
Any formula or somehow to change the entire column to read First Name Last Name. No comma.
Example -
Smith, Joe
Brown, Barry
-------------------------
Output desired -
Joe Smith
Barry Brown
View 8 Replies
View Related
May 16, 2008
I am attaching a sample sheet as a reference.
in fact the sheet could contain hundreds if not thousands of rows.
Look at column Player 1, the last 3 characters are AoS.
I want to find any rows where Player 1 has those three characters ( AoS ) and swap them with the contents of the Player 2.
BUT if that swap happens then the following swaps must occur as well:
Contents of Column "Side 1" swaps with Contents of Colum "Side 2"
Contents of Column "Player 1 Pts" swaps with Contents of Column "Player 2 Pts"
Ultimately I want this extended so that is the letters AoS appear in any of the following columns ( Player 4, Player 6, Player 8, Player 10)
the following swaps happens:
Contents of Column "Player 3" swaps with Contents of Column "Player 4"
Contents of Column "Side 3" swaps with Contents of Column "Side 4"
Contents of Column "Player 3 Pts" swaps with Contents of Column "Player 4 Pts"
Contents of Column "Player 5" swaps with Contents of Column "Player 6"
Contents of Column "Side 5" swaps with Contents of Column "Side 6"
Contents of Column "Player 5 Pts" swaps with Contents of Column "Player 6 Pts"
View 4 Replies
View Related
Aug 1, 2006
I want to swap values of two cells. can anyone help me on that? Eg. Cell A1
contains the value 20 & cell A2 contains the value 100. I want 100 on A1 &
20 on A2.
View 9 Replies
View Related
May 12, 2013
I have column AD where there are something like 2,500+ formulas. I would like to change the columns used in the formulas around. By that I mean the first formula is...
Code:
=SUM(AA6-X6)
...and I would like it to be...
Code:
=SUM(X6-AA6)
Now the thing is, the formulas are not continuous, there are breaks where there is a formula to sum say the previous dozen or so for example, then it skips a couple of rows and I have more formulas and then the sum say for the previous dozen for example and so on.
I just want those cells changed with the particular formulas as above.
View 1 Replies
View Related
Jul 30, 2013
I have let say column A and I have the date and name John 1913 all the way down to John 1940.
But what I need is a way to turn it around so A1 starts with John 1940 down to 1913.? If I drag down it counts up but I want it to count down if that makes sense.?
View 6 Replies
View Related
May 21, 2008
Have 5 columns (A1-E1) with different bond data: (respectively)
Coupon, Maturity, Settlement, Price, Yield (asset swap is F1)
Depending on the type of swap I am performing i want the ASWAP (user-created) function to reference different values within the row.
For example: Swap 1 = settlement, maturity, coupon, price, curve
(curve is a user input single number 1-3)
Swap 2 = settlement, maturity, yield, price, curve (yield in place of coup)
Swap 3 = settlement, maturity, yield, 100, curve (100 for par redemption)
etc. I won't type out all the iterations, not necessary.
The way that I want the ASWAP to recognize which Swap# to use is by inputting a number into a cell beside the Aswap column that I can input 1, 2, 3, etc., and then recalculate to get the desired outcome. Want to keep this a static reference as well as the price at par (each owning their own single cell, not a fill down the columns because there are too many).
So assuming G1 is the Swap# input, and H1 is 100...
How do i write a formula that is capable of reading the input in G1 and outputting the proper swap calc.
My gut feeling was along the lines of nested IF's with the corresponding formula... but i won't mess around in futility on here.
Let me know if this is too confusing without me putting up an example.
View 9 Replies
View Related
Jul 19, 2007
I would like to insert a form control (up and down arrows) into a specfied range of cells in a column - ideally the first column. When the form control up or down arrow of the assigned row is clicked it moves that row up or down essentially swapping positions with the row directly above or below. I've seen this functionality in custom excel applications but my searches for code on this topic have been fruitless.
View 5 Replies
View Related
Jan 31, 2013
Swapping the contents of 2 rows, my code does the operation but it is very slow. Here is my code
Sub swap()
Dim aTemp() As Variant
Dim swap As Boolean
swap = False
Dim row As Integer
row = 19
[Code] .......
View 2 Replies
View Related
Apr 19, 2007
Swap the data between two columns at a time. Here are multiple columns to be swaped in one worksheet and I have many worksheets to work with.
View 9 Replies
View Related
Aug 8, 2008
I am trying to chart a range of dates, for example. I have some boats that are on contract between dates a and b. I would liketo plot several boats with their contract date range. I have tried using a bar chart, but all the lines start at 0. I got it working using an Excel 2007 Stock chart, however, it is in the wrong orientation. I would like to Rotate the Chart 90 degrees, swap the axis, or find a better method all together. I cannot post the spreadsheet as its confidential.
View 2 Replies
View Related
Dec 4, 2012
My pivot table shows Towns as the Row headings and Month as the column headings. When I do a Chart, I get Towns on the X axis and Months as Y. I want the chart to show all my May data in a stacked column, then all my June data in another stacked column, etc. If I pick "Select Source Data" the options are greyed out. What's a mother to do?
View 1 Replies
View Related
Sep 11, 2007
I have an interactive chart displaying stacked area charts for 2006 and 2007
I currently have 2006 in front of 2007, but as the user chooses 1 of 20 units, it will look better to move 2007 in front of 2006
View 4 Replies
View Related
Feb 12, 2014
I am using the code below to "swap" the selected cell values in a column with the ones to the right of the selection. It works fine on unfiltered sheet, but if I apply an Autofilter, it copies both visible and hidden cells, and I only want to swap visible cells. What to modify?
[Code] .....
View 6 Replies
View Related
Sep 7, 2006
VBA will not allow the worksheet function MMult to be called during the subroutine. The error that flashes is: "Run-time error 1004. Unable to get the MMult property of the WorksheetFunction property"
Worksheets("MatrixOutput"). Range("ak4:di35").Select
Worksheets("MatrixOutput").Range("c4:ah80").Select
XTranspX = Application.WorksheetFunction.MMult("c4:ah80", "ak4:di35")
Worksheets("MatrixOutput").Range("b84:ag115").FormulaArray = XTranspX
View 4 Replies
View Related
Aug 1, 2009
I've a workbook in excel 2007 with 6 worksheets, 4 of witch have a named ranges, i would like to have a macro that consolidates this named ranges into one worksheet.
Example:
Sheet1 -- Skip Worksheet
Sheet2 -- Skip Worksheet
Sheet3 -- Range1
Sheet4 -- Range2
Sheet5 -- Range3
Sheet6 -- Range4
Result:
Sheet7
Range1
Range2
Range3
Range4
The Named Ranges are Excel 2007 Tables and they are positioned in the same place in Sheet3 to Sheet6.
View 4 Replies
View Related
Mar 23, 2013
What is the simplest way to do it in VBA?
View 3 Replies
View Related
Mar 24, 2009
I am using Excel 2003. I have a worksheet called "RawData" which has a continuous list of invoices, I need to separate off the first invoice from the rest of the invoices into a new worksheet and call it "sheet1". The number of rows from cell A1 at the top left corner varies and is never constant from invoice to invoice however the last row of the invoice I need to move always includes the text string "NET PAYABLE TO".
So I need to copy all rows from "A1" to the row that has the text to a new worksheet called "sheet1", I then need to delete those rows only from the original "RawData" worksheet, leaving the remaining invoices in "RawData" intact. If it is helpful to you, the first row on every invoice has the text string "TAX INVOICE".
There are no empty rows between the "NET PAYABLE TO" row at the end of an invoice and the "TAX INVOICE" row at the start of the next invoice, so it is literally a continuous list.
Can this routine then be continued on all the other invoices in "RawData", copying them to new worksheets in the same workbook "sheet2","sheet3" etc until there is no data left in RawData, bearing in mind that there may be 10 invoices or 100 invoices in the "RawData" sheet.
View 9 Replies
View Related
Jun 30, 2006
Can named ranges defined using the Application.names.add method be accessed using the worksheet(x).names(name) property?
I would like to access only the named ranges on one worksheet, but, it seems to me that the names collection of my worksheet contains no names.
If this is a result of my declaring the named ranges using the application.names.add method, is there a worksheet property that I could use to access only the named ranges on that worksheet?
View 9 Replies
View Related
Aug 22, 2006
Ok What I want to do is copy the info in Cells A1:N55 into cells A63 onwards, now this I have completed so far with the following code, but what I also want to do is copy any changes that are made in cells A1:N55 from when this copy function is run into cells A63:N118.
Does anyone know of any way I could go about doing this?
Sub CopyJob()
Dim wSheet As Worksheet, strWS As String
For Each wSheet In ActiveWorkbook.Sheets
strWS = Left(wSheet.Name, 2)
Select Case strWS
Case Is = "AJ", "CJ", "PJ" .......................
View 9 Replies
View Related
Jan 15, 2007
I am looking for a way to modify the following macro so that I can run the same code for multiple ranges that are on different worksheets.
Private Sub Workbook_SheetChange(ByVal Sh As Object, _
ByVal Target As Excel.Range)
Dim TimeStr As String
On Error Goto EndMacro
If Application.Intersect(Target, Range(" schedule!H4:H35,J4:J35,K4:K35,M4:M35,N4:N35,P4:P35,Q4:Q35,S4:S35,T4:T35,V4:V35,W4:W35,Y4:Y35,Z4:Z35,AB4:AB35")) Is Nothing Then
Exit Sub ..........................
View 9 Replies
View Related
Aug 13, 2013
If I copy worksheet in Excel, the named ranges are copied too. If I copy in VBA, they are not. Is the only solution to loop thru the named ranges or is there something smarter like some "fullcopy"?
View 2 Replies
View Related
Jun 16, 2008
I was after a bit of code to delete the range names on a particular worksheet I thought it couldn't be that hard but have only been able to find this in the archives, unfortunately I get an error when trying to execute it:
Sub Delete_My_Named_Ranges()
Dim n As Name
Dim Sht As String
' Put in name of sheet where the range is located
Sht = "Org Lookups"
For Each n In ThisWorkbook.Names
If n.RefersToRange.Worksheet.Name = Sht Then
n.Delete
End If
Next n
The error I'm getting is Run-Time error 1004, Application defined or object defined error.
View 9 Replies
View Related
Sep 23, 2006
I need the correct syntax to consolidate ranges from several worksheets into a summary worksheet - all in the same workbook. I am building the Array on the fly, and I keep getting errors. (Subscript out of range being the most recent).
The code now is opening only one workbook so I can keep it simple. It iterates through the sheets collection, and builds the array.
Private Sub cbConsolidateToRollups_Click()
Dim MyArray() As Variant
Dim Source As Variant
Dim SheetNames As Variant
Dim SingleQuote, DoubleQuote
SingleQuote = Chr(39)
DoubleQuote = Chr(34)
'set the directory to Rollups
ToPath = Application.DefaultFilePath & "Cost Tracking" & "Rollups"
ChDir ToPath ....................
View 9 Replies
View Related
Dec 30, 2008
hello. i'm new to excel and i'm really hoping for some serious help here. i have the basics down however i'm really stumped at this point. Let me try to explain my worksheet. the worksheet has a sheet for data which is used for drop list values in the new patient template sheet. the new patient template which is just that a blank entry sheet that the user duplicates and adds a new patient to the worksheet to track the visits made by medical staff. there could be over a hundred new patient sheets (each named by the patient) at any given time.
here is what i need help with: my sheet is setup on a monthly basis so each patient has a total of 4 - 5 weeks listed with entries for everytime a nurse visits that patient. what i need to know is how to search the cell entries for the first time a visit occurred and the date it occurred and this needs to be broken down by the 1st of the month - the 15th and then again for the 16th - the end of month for every patient sheet in the workbook. the ranges are not together that i need to search for example f14:f20, i14:i20, f35:f41 and so on for the first 15 days of the month. this all needs to happen like in a macro or somehow automatically.
View 14 Replies
View Related
Sep 26, 2011
I am trying to do index match function with criteria ranges in another worksheets. The code kept on giving me " #Value!"..
Here is the code:
Sub test1()
Dim myvalue As Variant
Dim wsname As String
Dim i As Integer
Dim j As Integer
Dim r1 As range
Dim r2 As range
Dim r3 As range
Dim r4 As range
wsname = "CustomerIDbyParts"
[Code] .......
The resulting cell of F5 kept on returning #Value!.. I suspect that my syntax for looking up the ranges from another worksheet is wrong?
View 3 Replies
View Related
Jan 27, 2012
I looking for a macro to look in a list in worksheet "Map_Ref", and take the Range Name of column "A" and copy that range in the corresponding Tab and range as specified in Columns "C" and "D" (i,e. take range name "BB Staff Counts_Tenured" from cell "A2" and copy that range in worksheet "Sheet2" (as specified in cell C2), range "A2" (as specified in cell D2). And so on.
List of worksheet "Map_Ref":
Column AColumn BColumn CColumn DTable/Range Title/Name:
Range in Tab "CMD_1"Copy to Tab:To Range:BB_Staff_Counts_TenuredA126..Q156Sheet2A2Branch_Counts_BBmarketsA35..
C47Sheet2A59Branch_Counts_Chase_SBRM_RegA30..E33
[Code] ........
View 6 Replies
View Related
May 1, 2012
I am trying to creat a macro that loops all the named ranges in a worksheet named "Labels", and copy the data to a new worksheet for each named range it finds in the same workbook and name each worksheet with the named range name.
View 5 Replies
View Related
Jan 27, 2008
I have a dynamic print range defined as follows:-
=OFFSET(Sheet1!$A$1,0,0,MATCH("PRINT_AREA_ROWS",Sheet1!$A:$A,0),MATCH("PRINT_AREA_COLUMNS",Sheet1!$1:$1,0)), lets say this equates to range("A1:D12")
I also have a workbook beforeprint event defined as follows:-
Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.LeftFooter = "Pete"
End Sub
My problem is that after the Print Event has fired , the dynamic range has been converted into a static one i.e range("A1:D12"). I have tried this on all version of Excel from 97 to 2007 and it behaves the same so premably this must be by design rather than a bug?
Am I doing something wrong? What is the work around? I'd rather not have to create the dynamic range within the print event procedure unless I have to as my workbook has many, many tabs!
View 9 Replies
View Related
Jan 22, 2010
I have got a macro (from Mr Excel's MVP) that hide certain cells according to assigned cell value
What I need is:
to hide certain ranges in different worksheets according to the assigned cell value in the first worksheet
if sheets1.cell A1= "hi" then
range (" goooo") in sheet 1.hide
range ("deeeee")in sheet 2 .hide
range ("faaaaa") in sheet 3.hide
the macro I had is :
====================================
====================================
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
If Target.Value = "hi" Then
Worksheets("Sheet1").Rows(2).Hidden = True
Else
Worksheets("Sheet1").Rows(2).Hidden = False
End If
End If
End Sub
View 9 Replies
View Related