Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default copy range between sheets

try this

Sub copyifnumber()
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(4).Range("C" & K, "L" & K).Value = _
Worksheets(1).Range("F" & J, "O" & J).Value
K = K + 1
End If
Next J
End Sub

--
Don Guillett
SalesAid Software

"chick-racer" wrote in message
...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy cell info to other sheets, other sheets dont contain all row. Ja Excel Worksheet Functions 1 November 1st 09 12:53 AM
Sheets named from range, and copy data? [email protected] Excel Discussion (Misc queries) 4 January 12th 07 02:53 PM
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? Dmitry Excel Worksheet Functions 6 March 29th 06 12:43 PM
in VBA Sheets("mysheet").Copy Befo=Sheets(1) how do i get a reference to the newly created copy of this sheet? Daniel Excel Worksheet Functions 1 July 6th 05 09:57 PM
copy sheet1 and name sheets using names from a range DL[_3_] Excel Programming 2 September 2nd 03 12:58 PM


All times are GMT +1. The time now is 02:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"