Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Slight adjustment needed for Macro



This Macro lets me copy down every 72 cells till 5112, But it does not copy
the font or size, can I adjust it to copy everthing in the cell,

Public Sub CopySelectionEvery72UntilRow5112()
Dim i As Long
With Selection(1)
For i = .Row + 72 To 5112 Step 72
Cells(i, .Column).Value = .Value
Next i
End With
End Sub


Thanks in advance for your help....Bob Vance


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Slight adjustment needed for Macro

Bob Vance wrote:
This Macro lets me copy down every 72 cells till 5112, But it does not copy
the font or size, can I adjust it to copy everthing in the cell,

Public Sub CopySelectionEvery72UntilRow5112()
Dim i As Long
With Selection(1)
For i = .Row + 72 To 5112 Step 72
Cells(i, .Column).Value = .Value
Next i
End With
End Sub


Thanks in advance for your help....Bob Vance


(the following is untested but relatively straightforward)
to copy the font and size along with value put:
Cells(i, .Column).Value = .Value
Cells(i, .Column).font.size = .font.size
Cells(i, .Column).font.fontstyle = .font.fontstyle
into the for-next loop

to copy 'everything' put this in the for-next:
Selection(1).copy Cells(i, .Column)

and then you might want to add just before the End Sub:
Application.CutCopyMode = False

Hope this helps,

Matthew

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Slight adjustment needed for Macro



--
Brilliant, Mr McGimpsey thanx for the help :)


Thanks in advance for your help....Bob Vance

"J.E. McGimpsey" wrote in message
...
one way:

Public Sub CopySelectionEvery72UntilRow5112()
Dim i As Long
Dim destRng As Range

With Selection(1)
Set destRng = .Cells
For i = .Row + 72 To 5112 Step 72
Set destRng = Union(destRng, Cells(i, .Column))
Next i
.Copy destRng
End With
End Sub


In article ,
"Bob Vance" wrote:

This Macro lets me copy down every 72 cells till 5112, But it does not

copy
the font or size, can I adjust it to copy everthing in the cell,

Public Sub CopySelectionEvery72UntilRow5112()
Dim i As Long
With Selection(1)
For i = .Row + 72 To 5112 Step 72
Cells(i, .Column).Value = .Value
Next i
End With
End Sub


Thanks in advance for your help....Bob Vance




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro adjustment Tel Excel Discussion (Misc queries) 6 July 6th 09 02:06 PM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
Event Macro adjustment needed - need to change font color also nick s Excel Worksheet Functions 2 November 28th 05 05:50 PM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 1 June 11th 05 12:44 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 0 June 10th 05 03:38 PM


All times are GMT +1. The time now is 06:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"