Select Range Of Contents From Column Which Lies In Between Other Columns
Mar 24, 2013
I have a worksheet in which column A:C contains slno,name etc. Col D contains numerical data.D4:D5 is col heading. D6:D41 contains numerical data. I want to copy the data from D6:D37 only. for this i tried the following but with negative result.
1.select cell D5.
2.press F5 and enter -to goto cell D37.
3. press control and shift and up arrow to select the upper cells. Excel selects from D37 to D4 whereas i want it to be from D37:D6.selecting D6 and then press control shift and enter keys takes me to the last cell with the data in the column, ie,D41.
How can I select only the required cells so that i can copy the content.selecting the first cell and then dragging the cross is not an expected answer to solve this.
View 4 Replies
ADVERTISEMENT
Jun 29, 2006
I'm having a problem in a single line of code in which I'm using a Range Object to essentially select an area of cells whose contents I want cleared.
Here is the
Sheets(Left(c.Value, Len(c.Value) - 1)).Range(Cells(4, 2), " &:& ", Cells(Rows.Count, "b").End(xlUp).Offset(0, 9).Select).ClearContents
I want the range part to evaluate as (b4:whatever the last cell is before the first blank row).
View 9 Replies
View Related
Feb 9, 2009
Was looking into this, but basically i have a repetitive task of copying contents from various columns, and pasting them into 1 column.
1 right after the other. I figured there could be a way for a macro to copy contents from multiple columns and paste them into 1 column.
I have including 2 files, 1 from the start of the file, and 1 how it should be so it will have clarify what i am trying to do.
So basically if you open book1 , i have factory install tabs,
I need the columns contents from the first tab the (5k-20k) starting with Column B, then E, then H, and so on( Every 3rd column starting with B ) to be copied and pasted in Column A of the (Factory Install Tab) ( last tab ).
If you open the 2nd file this will be clearly understood. In the second file in the factory install tab you will notice i did the first 2. I highlighted each starting part in yellow just so its easier to see. SO in column A you should have all the contents in the 5k-20k tab ( starting with b every 3rd ), pasted in column A 1 after the other.
The next tab is the 30k tab, i need all of the columns contents copied starting with B ( every 3rd again ), copied in Column C of the Factory Install tab. Basically every tab's contents needs to have its own column in the Factory Install tab.
If anyone could help that would be great, this is a very time consuming process manually, and it would seem like a macro could be made to easily copy contents.
View 6 Replies
View Related
Jun 26, 2009
I'm in the midst of preparing a Year-To-Date (YTD) simple financial report in MS Excel.
Firstly:
I allow user to enter a number in cell A2.
Secondly:
Cells from A4 - L4 are linked from Sheet1. Cell M4 will give sum of A4:L4. Users are not allowed to change data in cells from A4 - L4. Users are only required to enter a number between 1 to 12 in cell A2. Upon update cell A2, the VBA shall sum the number of columns as entered in cell A2.
For example, if user enter 3 in cell A2 then cell M4 must give sum of A4:C4. If user enter 8 in cell A2 then cell M4 must give sum of A4:H4.
View 9 Replies
View Related
Apr 8, 2014
I have an Excel workbook which has 10 rows of numbers with a min of 20 and max of 30. The random number lies in column B and this will be tested to see if it lies between the min and max. I need to loop this 10 time over
I first started out declaring the 3 variables and assigning values to each variable. It works if I assign a value of 22 for Number but I want VBA to see the Number and make a decision (True or False) if that number lies within the range of 20 to 30.
Should I name the Number variable as a variable because its value will change depending on if it matches the conditions? Also would a case be easier? Between.xlsx
View 4 Replies
View Related
Feb 11, 2014
I have a range variable named data I want to clear all the data in the 3rd column in the range variable I know how to reference a single location in the range variable but not a whole column. see example code below
[Code] .....
View 3 Replies
View Related
Jan 6, 2010
I'm trying to select a range that will be changing by column. I'm not sure why my syntax isn't working. What I've got:
View 2 Replies
View Related
May 1, 2014
I have below a code that is selecting from A11 down as far as there is data and across a certain number of columns then sets a print area.
Currently the columns go A, B, JW, JX, JY, JZ, KA, KB as C through to JV are hidden. I have tried to offset the columns by 7 to see if it will select A-KB but it is selecting cells that are hidden and only selecting A-G. I need it to go past the hidden columns. Here is the code:
[Code] ......
Could I also get a code to go from A10 and move over to KB and create a range from there e.g. KB-KJ and last row from there?
View 10 Replies
View Related
May 6, 2014
I need a macro to start at cell A11 and select across 10 columns and down to the Lastrow (last row with any data).
There are hidden columns after column D so it CANNOT have any columns hardcoded except for column A.
This selection then needs to be set as a single print area to print out on 1 page. I have already set Rows 1-10 as a title area to print at the top of each page.
Code i currently have is:
[Code] .......
I just need it to now go across 10 visible columns and set as a single print area.
View 8 Replies
View Related
Dec 10, 2013
I have a macro that allows me to select a range of columns and unhide any that are hidden. I am on the sheet "Employees", but the action happens on the sheet "Enter". I can run this macro when I am on "Employees" and jumps top "Enter" and works exactly as I want it to.
Code:
Sheets("Enter").Select
Columns("B:T").Select
Selection.EntireColumn.Hidden = False
Range("M8") = Sheets("Employees").Range("B5")
Range("I7").Select
But when I try to run it as part of another macro that begins on "Employees", I get "Run-time error '1004': Select method of Range class failed", and Columns("B:T") is highlighted.
View 4 Replies
View Related
Jul 30, 2014
Function to select two columns based on the header and the variable given.
Sample excel file attached for your ref.
Excel sample.JPG
Find the excel file in which I am looking for an formula which will look up variable in Col A for Eg USD and search the same in Row 1 and then will select COL D:E and so forth for other currency.
View 4 Replies
View Related
Jan 30, 2012
I'm trying to make the below two column selections into a selected range to clear out formulas/values in the range.
Current code segments:
ActiveCell.EntireColumn.Select
Columns(ActiveSheet.UsedRange.Columns(ActiveSheet.UsedRange.Columns.Count).Column).EntireColumn.Select
Is there a way to combine the two code segments into one selected range?
View 6 Replies
View Related
Mar 26, 2013
i want information on my "Intra-op tab" to automatically populate on my "Tissue" tab. In Column "A" of my intra-op tab i enter case id's, 1 per row, and i would enter a date received under column "D". On my "Tissue" tab, i also enter those case id's under column "A" but i would have multiple rows of the same number. I want that whenever i type a specific case id on my "Tissue" tab, it will automatically fill in the date in column "T", the date that coincides with the case id in column "D" of my "Intra-op Kit" tab.
View 1 Replies
View Related
Feb 11, 2013
I have a sheet that begining in A3 and going down need to look for the First Instance of the text String "Loan Documents" and down to the last instance and select the corresponding range in column B.
Example: if the Text String appears in Range(A14:A32) I need the Range(B14:B32) to be my selected range.
View 1 Replies
View Related
Mar 4, 2009
If i have row 10-20 in column A filled, what vba code would i need to select a range in column C that selects rows 10-20
If that 10-20 rows in column A chnages to say 10-50 the vba code will select 10-50 in column C
View 10 Replies
View Related
Jul 24, 2014
I have the following code Range("M402").Select
This very simple code brings me to M402 everytime I click on the button.
However, I would like to stay in the same column that I am at the moment when I click the button, and go to row 402. (i.e. if I am in cell "Z56", I would like to be redirected to "Z402" when I click the button.
View 3 Replies
View Related
Aug 12, 2008
I have defined my last row and column by using:
lr = Sheets("week1").Cells(Rows.Count, "A").End(xlUp).Row
LC = Sheets("week1").Cells(1, Columns.Count).End(xlToLeft).Column
Now how do I select the range starting at A2 through the last used column ( LC ) through the last row ( LR )?
View 9 Replies
View Related
May 21, 2008
What is the best way to select every third cell in column c starting with cell C5
View 3 Replies
View Related
Mar 4, 2009
I wish to collect an arbitary range of data in a column. Hence I wish to identify were the data begins (for example C10) and where the data ends (for example C22), and then copy it and paste it at another sheet. How to do that with VBA-code?
View 9 Replies
View Related
May 7, 2009
I'm trying to select a contiguous range of cells in a column and then iterate over that. I keep getting error "91", object variable not set. I have:
View 5 Replies
View Related
Mar 12, 2003
How would a code look like to select a range with a column header on top. in the code you provided, it selected the entire W column. How would you select the range given that the W column was called Address?
Sheets("Sheet1").Select
Range("W1").Select
Range(Selection, Selection.End(xlDown)).Name = "Problem_Area"
View 6 Replies
View Related
Jun 10, 2013
I have a user form that has one combo box on it that right now references one column of data.
Now I am being asked to have three columns of data and the combo box to show one of the three when a certain criteria is met.
I believe it would be easiest to have an additional combox with a change event when the box is populated with "whatever" in the field
So S:3 to S:5 have A, B, C
And EC:1-EC:59, ED:1-ED:59, EE:1-EE:59 contain the data that should show when S:3, S:4, or S:5 is selected.
If S:3 is selected then the list in EC:1 - EC59 would show and so on.
View 2 Replies
View Related
Dec 30, 2013
I have attached a workbook stating my problem.
file1.xlsx
View 10 Replies
View Related
Nov 18, 2013
setup:
Columns: c)6:00 AM, d)6:15 AM, e)6:30 AM
Rows: 4)tech1 Phone, 5)Tech2 Phone, 6)Tech3 Phone
What I am tying to do is to select the column that matches the time, for instance anything before 6 AM would select Column C, betweeb 6 and 6:14 still selects column C, 6:15 to 6:29 selects column D, Etc
View 2 Replies
View Related
Aug 19, 2009
I recently found this code for selecting a whole column of non continuous cells.
ActiveSheet.Range("a1",ActiveSheet.Range("a65536").End(xlUp)).Select
How can I change the "a1" & "a65536" so it can work and be activecell instead?
View 9 Replies
View Related
Jul 23, 2008
I have this:
Private Sub CommandButton1_Click()
Worksheets("Sheet1").Activate
Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(rowOffset:=1, columnOffset:=0).Activate
ActiveCell.PasteSpecial
End Sub
it errors to: SELECT METHOD OR RANGE CLASS FAILED
View 9 Replies
View Related
Jun 6, 2014
I have multiple tables like the one in the picture and have to duplicate this code for different known ranges.
View 11 Replies
View Related
Nov 9, 2005
I've got 12 columns (headed Jan - Dec), each of which contains a combination
of numerical & blank cells. For each row, I want to select the first
non-blank cell and return the column header that it lies in e.g. Row 1, first
non-blank cell is in the Apr column, so I want the text "Apr" to be returned
to another cell.
View 9 Replies
View Related
Dec 21, 2008
I'm trying to sort a whole list of data that's been separated into blocks with a row containing the value "a" like:
row 9 a
row 10 455
row 11 8892
row 12 34
row 13 a
row 14 578
row 15 92
row 16 a
etc..
I want to sort each block into ascending order using VBA code and then add in some extra code to do some more analysis.
The data to be sorted is in Column D, and there are also values in Column C and B that need to be sorted with the Column D values (so that they stay in the same rows).
View 9 Replies
View Related
Jul 19, 2009
I am trying to select a range based on two variables which store the column numbers. what I have is:
View 4 Replies
View Related