Thread: loop macro
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mike Fogleman Mike Fogleman is offline
external usenet poster
 
Posts: 1,092
Default loop macro

I would think that you would want to include the starting fiber in the fiber
count for the row. In other words, if you have a 6 in A2 you would want only
6 fibers in that row, which would include the starting fiber, so the macro
should only add 5 more for a total of 6. If so, modify one line like this:

fibcnt = Range("A2").Value - 1

That will make "tohere" one column shorter.

Mike F

"Mike Fogleman" wrote in message
...
OK, this macro uses Excels Auto_Fill from a list feature, so you will need
to create a Custom List of the fiber colors. You do that in
Tools/Options/Custom Lists. Once you have that, put this code in a general
module. Assign it to a worksheet button if you wish for ease of use.

Sub Paste_fibers()

Dim fromhere As String
Dim tohere As String
Dim fibcnt As Long

fibcnt = Range("A2").Value
fromhere = ActiveCell.Address
tohere = ActiveCell.Offset(0, fibcnt).Address
Selection.AutoFill Destination:=Range(fromhere & ":" & tohere)

End Sub

Mike F
"cacique" wrote in
message ...

Any One that can help me!!
thanks!!!


--
cacique
------------------------------------------------------------------------
cacique's Profile:
http://www.excelforum.com/member.php...o&userid=24861
View this thread:
http://www.excelforum.com/showthread...hreadid=384058