Copy Non-Consecutive Columns
Jan 26, 2008
I have to work with a report where columns are sometimes added or removed. However, the columns I need are always there, just not always at the same place. To identify them, I have my macro search for their title (they never change) and enter the column number in a variable (iSID, iPID, iEPN, iEPT, and iOD).
I now need to take these five columns and copy them into another workbook. Usually, I would use something like Range("A:A":"D:D":etc). but now I'm a bit stuck. I wanted to use something like Range(Columns(iSID), Columns(iPID), etc), but I can't seem to be able to write that correctly or something (I get errors like "wrong number of arguments or invalid property assignment"). I guess I could copy the columns one by one using Columns(iSID), but I was wondering if there wouldn't be a more elegant way to do that.
View 2 Replies
ADVERTISEMENT
Sep 3, 2013
I am trying to simply copy the range of C7:C LastRow and W7:W LastRow
The code below copies all columns C:W to LastRow. I want just column C and column W.
I've tried some other combinations, but it has me stumped.
Code:
'Range("C7:C" & LastRow, "W7:W" & LastRow).Copy
View 4 Replies
View Related
Jun 13, 2008
I have Excel 2000.
If I have columns A B C D E how do I copy A and C only (at the same time) and paste them into a new workbook? I get a popup saying it's not possible.
I don't want to copy one column at a time in case I make a mistake and item 1 in column A no longer lines up with item 1 in column C (I'll be performing this at least daily and the results will go on a website)
View 10 Replies
View Related
May 6, 2008
What is the fastest way to delete 2 consecutive columns after skipping 2 columns?
For eg: Column A Column B Column C Column D Column E Column F
I would like to delete column A & B, skip Column C & D, and then delete Column E & F
View 4 Replies
View Related
Dec 11, 2013
I was trying to see the values only if the same value arrived more than three times in the given range.
Ex:
ABCDEFGHIJ
1AAAABAA
2
in the given range A1:J1, I would like to count 'A' only if it repeats more than or equal to 3 times. For row 1 I should get count as 4.
View 1 Replies
View Related
Aug 17, 2009
Is it possible to load non-consecutive columns from a worksheet into an array? This works fine for 1 column:
View 2 Replies
View Related
Oct 31, 2013
I need an equation that will return a 1 in column F if data is available (cell is populated) in 2013 or last two years (2012 & 2013) or last three years (2011 & 2012 & 2013) or last four years or last five years. A zero counts as data.
Data is set up as:
Years in columns
2009
2010
2011
2012
2013
Count
product 1
34
32
33
31
35
1
[Code] ......
View 9 Replies
View Related
Feb 18, 2008
I have data in 3 different columns (A, C, and E) to name a few. I want to average each of these columns, but if any of them include zero values, I want to exclude that from my calculation.
Example:
Column A = 10
Column B = 0
Column C = 3
Right now, my "average" formula, is showing the average as 4.33. (average a5, b5, c5)
The real average I'm looking for is 6.5. What is the best way to setup my formula?
View 9 Replies
View Related
Apr 24, 2014
I have a worksheet with a series of data in rows. Every 40th row is a sum of the previous forty rows.
I have a second worksheet that in a series of columns uses the 40th row sums from the other sheet. So column 1 uses row 40, column 2 uses row 80 data, etc.
Every time I update this, I create the new column using a copy and insert copied cells and then have to go to each field on the new column that uses this other worksheet to correctly update the formula for the new row. As when I do it this way, if Column 1 cell a1 formula said "worksheet2!A40, then the new column 2 cell b1 says "worksheet2!B40, where I want to make it be worksheet2!A80. I have tried highlighting a series of these corrected columns and dragging the formula over but still get a change in columns vs row from the other sheet.
I am looking to see if there is a way to do something like (in layman's expression):
(first column) worksheet 1, cell a1 = worksheet 2 cell A40
(second column) worksheet 1, cell b1 = worksheet 2 Cell A80
(third column) worksheet 1, cell c1 = worksheet 2 Cell (A80+40)
etc....
View 3 Replies
View Related
Jun 26, 2013
I have a table where I need to make a drop down list in two consecutive columns (G and H). The list in column H will depend on the Option chosen in Column H.
Column G
Compensation
Payroll
Column H
COMPENSATION
Savings Box
Update Information General PAYROLL
Payment Inquiry Update Information Severance Pay
As shown above If you select Compensation in G you will have those three options in column H and the same for Payroll.
View 2 Replies
View Related
Jun 27, 2007
I have an Excel worksheet (ver.2003) containing data more than 5000 rows. I need to run a macro everyday to do copy a value for that cell each day from another cell in different respective rows :
Using # as a marker in a specific col (say col X2, X14, X27, X43 and so on ) I want to copy value from another cell (AE2, AE14, AE27, AE43 and so on) containing a forumla and paste as a value to a cell say B4 in a row of fixed range (say B4:V4, B16:V16 and so on), which is two rows below the marker. The value to be copied is located in the 7th cell (say AE2) to the right of the marker cell (X2). If first cell is blank (say B4) then I copy data into the first cell. Every time I run the macro the value should be copied to next blank cell in that row (C4, D4 and so on).
I need to run the macro everyday for a specified no. of days say 21 working days in a month, which is the length of the range) copy the value for each in different rows as explained above. What is the VB Excel macro for this? ...
View 10 Replies
View Related
Aug 4, 2014
I would like a macro which will copy range $A$1:$Z$1 and paste it as values into AA1:ZZ1.
Easy enough on the first run; but on the second, copy the same range $A$1:$Z$1 and paste it as values into AA2:ZZ2
third run into AA3:ZZ3, etc.
View 2 Replies
View Related
Mar 10, 2014
B+N Total sheet is where the data is and the decider is Column 'AF' which is already formulated and has 2 options: 'MMS' or 'Retail'.
I'm trying to write a code which needs to do:
If B+N Total sheet's AF Column has 'MMS' then copy that row and paste it into ADI MMS consecutively.
Just like the example attached Row 2,3,5 is MMS and not row 4. So I'm trying to get those rows in periodical order as Row 2,3,4 into ADI MMS Sheet.
View 3 Replies
View Related
May 27, 2014
I'm using Excel 2010 and my spreadsheet contains numbers in columns A:E and approx 500+ rows. Here is a 10 row example of my data:
A B C D E
0 1 2 3 4
5 6 7 8 9
0 2 4 6 8
1 3 5 7 9
1 2 4 5 8
3 4 5 6 9
9 8 1 2 3
7 6 1 4 0
0 8 2 1 9
1 0 5 3 2
I would like to count the number of consecutive times each number appears (to a max of 9 consecutive times in a row). So, from my example above:
Number 1 appears:
1 consecutive time = 1 (appears in row 1)
2 consecutive times = 1 (appears in rows 4 & 5)
3 consecutive times = 0
4 consecutive times = 1 (appears in rows 7, 8, 9 & 10)
Number 2 appears:
1 consecutive time = 4 (appears in row 1, row 3, row 5 & row 7)
2 consecutive times = 1 (appears in rows 9 & 10)
3 consecutive times = 0
4 consecutive times = 0
Number 5 appears:
1 consecutive time = 2 (appears in row 2 & row 10)
2 consecutive times = 0
3 consecutive times = 1 (appears in rows 4, 5 & 6)
4 consecutive times = 0
and so on....
View 9 Replies
View Related
Feb 18, 2014
I have data from (row 1, column 1) to (row 53, column 5) on 283 consecutive worksheets in a singular excel file that I would like to be presented on a singular worksheet starting from the data on worksheet 1 and descending to the data on worksheet 283.
I am looking for a copy and paste loop solution that will copy the data from each page and sequentially paste the results on a singular output page in descending order (worksheet 1 data, worksheet 2 data... etc) so that I can sort the data.
View 1 Replies
View Related
Feb 26, 2013
I am working on two worksheets. On my first worksheet I have one column with consecutive numbering starting from Cell 8.
A8 = 1
A9 = 2
A10 = 3
A11 = 4
A12 = 5
On my second worksheet I want to link to the values in the first worksheet but not in a consecutive manner. Each number will have an interval of 15 cells. As shown below:
D15 = 'link on Sheet1!A8'
D30 = 'link on Sheet1!A9'
D45 = 'link on Sheet1!A10'
D60 = 'link on Sheet1!A11'
D75 = 'link on Sheet1!A12'
View 6 Replies
View Related
Dec 30, 2008
when i copy columns resulted from another columns operations and paste in new sheet i got garbage ,could you tell me why and how to overcome this problem.
View 2 Replies
View Related
Aug 6, 2009
Example:................
The key point is that I have over 400 columns grouped in three, offset by one row down for each (this is due to a different formula I have working). Each column is 60 numbers long (not including empty cells above data). I want to copy all of these columns into a single set of three columns on another sheet (Sheet2). (These will be the fifth, sixth, and seventh columns, E, F, and G. If it would be simpler, I could simply copy the third of each set of columns on Sheet1 (C, F, I) to column G of Sheet2. Then there would be a total of 144 columns being copied (60 numbers per column).) All of this copying has to be values-only as the original columns consist of formulas referencing outside cells. Sheet2 should look like this:.............
View 7 Replies
View Related
Jun 7, 2006
I have 2 worksheets in which I have to copy one column of cells from one to
the other. The problem is that the "main" worksheet lists nearly 3,500
clients and I have to copy numbers into the "main" worksheet on weekly basis
from another worksheet that lists only about 1,100 of those 3,500 clients.
Both client lists are in alphabetical order, but I obviously cannot just copy
one column into the other, because then the numbers won't be matching the
correct clients.
View 10 Replies
View Related
Apr 21, 2007
I have 2 workbooks (workbook1 & workbook2). Information in column A and column N must match both workbooks per row/ cell (ie. if A2 and N2 in workbook1 match workbook2, copy information from 3 other columns (S, T, U from from workbook1 into workbook2 - cells S2, T2, U2). Workbook2 may have information in column S, T, U, but I need to over-write it with the information from workbook1. If the information does not match per that row/cell (ie. A2 in both worksheets are the same, but N2, they are not, so go to the next line that does match and copy the information into worksheet2). I do not want to use a V- lookup for this problem. I really need a marco.
View 3 Replies
View Related
Jun 24, 2008
I am currently working on a data analysis project (data mining) and need to collect and later analyze statistics for the inputs which control a series of calculations. These statistics are shown in the Statistics 1, Statistics 2 and Statistics 3 cells in the workbook that I attached. The inputs are X,Y; all possible values for these inputs are listed in the N,O columns. Basically I need a macro which would take the values from these two columns and place them pair after pair into the controlling cells (K3, L3), then it would copy cells H2 through L3 (updated stats) to a new sheet after each copy operation - so that I will finally have a list of statistics for all of the input pairs.
View 3 Replies
View Related
Nov 14, 2008
The worksheet I have copies and pastes the whole row based on value in column Q. How can I modify my code to copy only the data from columns F, G, J, and Q in the same row. Example: if Q5 is "paid" copy F5, G5, J5, and Q5 to Summary sheet in columns A to D.
Sub cond_copy()
Sheets("List").Select
rowcount = Cells(Cells.Rows.Count, "q").End(xlUp).Row
For i = 1 To rowcount
Range("q" & i).Select
check_value = ActiveCell
If check_value = "aot" Or check_value = "paid" Then
ActiveCell.EntireRow.Copy
Sheets("Summary").Select
rowcount = Cells(Cells.Rows.Count, "a").End(xlUp).Row
Range("a" & rowcount + 1).Select
ActiveSheet.Paste
Sheets("List").Select
End If
Next
End Sub
View 4 Replies
View Related
Mar 18, 2008
I need to count the maximum amount of consecutive crosses that appear in a list. For instance:
x
x
x
x
x
x
x
x
x
the result would be 4, because the highest amount of consecutive crosses in this list is 4 times.
Would anyone mind providing me with a formula for this, please? The list is from C5:C52.
View 10 Replies
View Related
Aug 10, 2006
I received the answer on assigning consecutive dates but what can be done to
the formula
=INT($A$1+INT(ROW()-1)/30)
TO:
1. Not include weekends
2. Only assign the date to a certain person's name if there is multiple reps
on the spreadsheet.
View 14 Replies
View Related
Jul 22, 2008
I have 3 columns, in column 1 and 2 there will be numbers and I want automatically to get in column 3 the range of numbers between Column 1 and Column 2
Column 1 - 100
Column 2 - 500
Column 3 - 100, 101, 102, ..., 500
View 9 Replies
View Related
Feb 18, 2014
I am having a hard time with a copying values, it is best if I make an example. The idea is: if A1 is "Toyota" and there is some other text also in B1, B2 and B3 then A1,A2 and A3 are "Toyota"
Book1.xls
View 4 Replies
View Related
Jul 15, 2005
when I want to send by email I find I cannot copy these smaller sheets - every attempt at a copy will also copy the hidden columns.
How to copy a spreadsheet and NOT pick up the hidden columns?
I realise this might be nearly impossible or considered useless because no hidden columns would mean either making the copy with blank hidden columns or altering all formulas to suit a sheet which now does not have all the original columns.
View 2 Replies
View Related
Jul 30, 2013
What vba code can transpose ALl column A values from sheet 1 to get a row values to sheet 2.
example in sheet 1 column A i have
Apple
Orange
Mango
Guava
Pineapple
and in sheet 2 it will be as
A B c d
Apple Orange Mango Guava and etc.
View 1 Replies
View Related
Feb 26, 2014
I have a worksheet with values that change weekly (sample, attached). The number of rows and columns may change as well. However, columns A, B, and C will always have date, name and location data and therefore must be preserved. Aside from the headers, the values in the columns from D onward will include only the numbers 0, 1, 2, or 3.
I need to copy the columns to Sheet2 and then delete all of the columns from D onward that do not have a 2 or a 3 in them. In other words, I need to always keep columns A, B, and C, and also keep any column (and all of its data) if a 2 and/or 3 shows up anywhere in the column.
I imagine there is even a quicker way to cherry pick the first three columns, as well as any other columns that have a 2 or 3 in them, and then paste them to the second worksheet. However, either approach will meet the need well enough.
View 3 Replies
View Related
Jul 19, 2009
I have one master sheet that I update daily from several other spreadsheets.Right now I'm having to manually place the columns side by side and copy the new data over. The column and row format are exactly the same for each of these spreadsheets. Each day we go out and collect data, just numbers. I then must copy the numbers to the master sheet. I cant just copy and paste the columns because in the rows that don't have data in them it will overwrite the previous days information with blanks. I've attached a sample with some dummy data in it. I only update data in columns G and H.
View 5 Replies
View Related