Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
copy range between sheets
I would like to know how I can copy ranges between sheets.
What i have for code right now doesnt work at all. Could someone give advice? Thank you. here's what i have so far: roundNumber = InputBox("Enter the round number for which you would like summary for.", "Summary") K = 4 For J = 4 To 700 If Worksheets(1).Cells(J, "C") = roundNumber Then Set rng = Worksheets(1).Range("F" & J, "O" & J) Set newrng = Worksheets(4).Range("C" & K, "L" & K) newrng = rng K = K + 1 End If Next J --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
copy range between sheets
thanks alot. I dont know why i didnt think of trying that.
Now, is there a line i can add in order to keep the same formatting. I guess what i'm trying to say is, I have some cells with shading and/or colored font, is there a way to make it look the same when it's copied to the next worksheet? Much appreciated. --- Message posted from http://www.ExcelForum.com/ |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
copy range between sheets
It would have been nice had you mentioned that to start with. The way you
had it written you were doing VALUES. Sub PasteALL() Dim roundnumber As Integer roundnumber = InputBox("Enter the round number for which you would like summary for.", "Summary") K = 4 For J = 4 To 700 If Worksheets(1).Cells(J, "C") = roundnumber Then Worksheets(1).Range("F" & J, "O" & J).Copy Worksheets(4).Range("C" & K).PasteSpecial Paste:=xlPasteAll K = K + 1 End If Next J End Sub -- Don Guillett SalesAid Software "chick-racer" wrote in message ... thanks alot. I dont know why i didnt think of trying that. Now, is there a line i can add in order to keep the same formatting. I guess what i'm trying to say is, I have some cells with shading and/or colored font, is there a way to make it look the same when it's copied to the next worksheet? Much appreciated. --- Message posted from http://www.ExcelForum.com/ |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
copy range between sheets
Worksheets(1).Range("F" & J, "O" & J).copy _
Worksheets(4).Range("C" & K) if your source contains formulas, but you want to only transfer the resulting values Worksheets(1).Range("F" & J, "O" & J).copy Worksheets(4).Range("C" & K).PasteSpecial xlValues Worksheets(4).Range("C" & K).PasteSpecial xlFormats -- Regards, Tom Ogilvy "chick-racer" wrote in message ... thanks alot. I dont know why i didnt think of trying that. Now, is there a line i can add in order to keep the same formatting. I guess what i'm trying to say is, I have some cells with shading and/or colored font, is there a way to make it look the same when it's copied to the next worksheet? Much appreciated. --- Message posted from http://www.ExcelForum.com/ |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
copy range between sheets
thank you very much for the help.. works like a charm!
Now i have one final question. Is there a way to make a range that has columns missing? For example, I would like the data in Columns A,B,F thru O, Q,R since there are some columns on the origional sheet that i do not want to copy and paste to the new worksheet. --- Message posted from http://www.ExcelForum.com/ |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
copy range between sheets
if you use Range("A13,B13,F13,J13") and copy to another sheet it will
copy into a,b,c,d so you would have to use several range copy's to get what you want Range("A13,B13") Range("F13") Range("J13") -- Don Guillett SalesAid Software "chick-racer" wrote in message ... thank you very much for the help.. works like a charm! Now i have one final question. Is there a way to make a range that has columns missing? For example, I would like the data in Columns A,B,F thru O, Q,R since there are some columns on the origional sheet that i do not want to copy and paste to the new worksheet. --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
copy cell info to other sheets, other sheets dont contain all row. | Excel Worksheet Functions | |||
Sheets named from range, and copy data? | Excel Discussion (Misc queries) | |||
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? | Excel Worksheet Functions | |||
in VBA Sheets("mysheet").Copy Befo=Sheets(1) how do i get a reference to the newly created copy of this sheet? | Excel Worksheet Functions | |||
copy sheet1 and name sheets using names from a range | Excel Programming |