ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   HELP: Copying and pasting to Sheets... (https://www.excelbanter.com/excel-programming/317203-help-copying-pasting-sheets.html)

aking1987[_15_]

HELP: Copying and pasting to Sheets...
 

Dear ExcelTip Experts...

I have created a button on a main sheet. Upon pressin this button, i
will check the values of column C's Cells. If any of the values match
WORKSHEET name, It will copy a variety of cells, and paste it to th
WORKSHEET with the matching name to the cell.

here is my code...

Code
-------------------

Private Sub CmdUpdate_Click()

For Each Sheet In ActiveWorkbook.Sheets
Select Case Sheet.Name
Case "Master Numbers"
' DO NOTHING
Case Else
For Sheetnamerange = 1 To 999
If Sheet.Name = Range("C" & Sheetnamerange) Then
Range("A" & Sheetnamerange & ":B" & Sheetnamerange).Select
Selection.Copy
Sheets(Range("C2").Value).Select
Range("A" & Sheetnamerange + 1 & ":B" & Sheetnamerange + 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,_
SkipBlanks:=False, Transpose:=False
Sheets("Master Numbers").Select
Range("D" & Sheetnamerange + 1 & ":H" & Sheetnamerange + 1).Select
Application.CutCopyMode = False
Selection.Copy
Sheets(Range("C2").Value).Select
Range("C" & Sheetnamerange + 1 & ":G" & Sheetnamerange + 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,_
SkipBlanks:=False, Transpose:=False
End If
Next




End Select
Next

End Su
-------------------


I just cant get this to work

--
aking198
-----------------------------------------------------------------------
aking1987's Profile: http://www.excelforum.com/member.php...fo&userid=1539
View this thread: http://www.excelforum.com/showthread.php?threadid=31479



All times are GMT +1. The time now is 07:32 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com