UNTEngineer
New Member
- Joined
- Mar 8, 2016
- Messages
- 11
Hello,
After many searches through your forum and on Google, Ive given up and having to resort to help on the forum.
Im trying to copy a range of text from my main sheet and paste it to subsequent sheets - that part works fine.
Next Im trying to copy the formatting and paste only the formatting to those sheets. This part keeps throwing errors, and I have no idea why.
I tried using a regular range rather than selecting Cells; that didnt work. I tried using the Cells.Cell Format to copy just the format, and that didnt work. Basically, Im trying to copy specific cells based on that if statement, and I need the format of those cells to go with the text.
After many searches through your forum and on Google, Ive given up and having to resort to help on the forum.
Im trying to copy a range of text from my main sheet and paste it to subsequent sheets - that part works fine.
Next Im trying to copy the formatting and paste only the formatting to those sheets. This part keeps throwing errors, and I have no idea why.
Code:
n = 0
For i = 8 To 210
If Cells(i, 12).Value = PM1 Then
n = n + 1
nn = 8 + (n - 1)
For j = 2 To 25
Worksheets(PM1).Cells(nn, j).Value = Cells(i, j).Value
Worksheets(Main).Range(Cells(i,j)).Copy
Worksheets(PM1).Range(Cells(i,j)).PasteSpecial xlPasteFormats
I tried using a regular range rather than selecting Cells; that didnt work. I tried using the Cells.Cell Format to copy just the format, and that didnt work. Basically, Im trying to copy specific cells based on that if statement, and I need the format of those cells to go with the text.