Paste special in vba (pste formula by creating an increasing series)

keyra

New Member
Joined
Dec 5, 2016
Messages
9
Dear reader,
I have a table with multiples columns from which the last one contains formulas. I have this macro(below) which helps me to make sure that this column with formulas has no blank cells. It copies and paste right with formula format but i need to paste them as an increasing series. For ex in the very first cell with formula located on row 11, i have cell BC11 as reference. for next rows 12, 13, 14 ,in the formula i need to have BC12, BC13, BC14. Could you please advise me how can i do it?

"dim name as string
For each c in range("B11:B" & cells(rows.count,2).end(xlup).row)
If cells(c.row,55)>" " Then
Name = cells(c.row,55).formula
Cells(c.row, 55).copy
Else
Cells(c.row,55).value=name
Cells(c.row,55).pasteSpecial (xlpasteformats)
End if
Next
end sub

Thank u so much for your help.
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
I can't see where you're pasting your formulas, only your formats

If you want to copy and then pasteSpecial(xlPasteAll) then your formulas will go across as well; correcting any "locking" (i.e. the use of $ to lock to certain cells) will ensure your formulas paste correctly
 
Upvote 0
I can't see where you're pasting your formulas, only your formats

Let's take2 columns for example. A : has always values. B : has formulas but also it may have blank cells. For one blank cell from column B, i need to copy the formula from above cell. Right now it does that but if it takes the formula from row 11 it keeps me row 11 for each paste. I need to change it depending on what row the blank cell is. Can i do that?
 
Upvote 0

Forum statistics

Threads
1,203,060
Messages
6,053,303
Members
444,650
Latest member
bookendinSA

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top