View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Simplifying VBA code

Martin, Thanks for pointing that out.

--
Don Guillett
SalesAid Software

"Martin Fishlock" wrote in message
...
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