View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Pete_UK Pete_UK is offline
external usenet poster
 
Posts: 8,856
Default Simplifying VBA code

But wouldn't this act on columns F, H and J ?

Pete

Martin Fishlock wrote:

Don,

The original request was for columns F,H and I and therfore a step in the
for loop is required:

for i = 6 to 10 step 2
cells(12,i).copy
range(cells(13,i),cells(lrow-1,i)).PasteSpecial (xlPasteFormats)
next i

--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.


"Don Guillett" wrote:

maybe where col F =6

for i = 6 to 8
cells(12,i).copy
range(cells(13,i),cells(lrow-1,i)).PasteSpecial (xlPasteFormats)
next i

--
Don Guillett
SalesAid Software

"Michael M" wrote in message
...
Hi All
The following code works fine, but for my information and education, is
there a simpler way to write it ?

range("F12").Copy
range("F13:F" & lrow - 1).PasteSpecial (xlPasteFormats)
range("H12").Copy
range("H13:H" & lrow - 1).PasteSpecial (xlPasteFormats)
range("I12").Copy
range("I13:I" & lrow - 1).PasteSpecial (xlPasteFormats)

Thanks for any assistance
Michael M