Thread: .Value "issue"
View Single Post
  #15   Report Post  
Posted to microsoft.public.excel.programming
GS[_6_] GS[_6_] is offline
external usenet poster
 
Posts: 1,182
Default .Value "issue"

Hi Garry,

Am Tue, 30 Jun 2015 02:40:22 -0400 schrieb GS:

Sub Run37Hours()
Dim n&, sRefs$, vRefs

sRefs = "AG19, AG21:AG27, AG29:AG35, AG39:AG44, AG47, AG49,"
sRefs = sRefs & "AG52, AG55:AG60, AG63:AG66, AG69, AG73:AG78"
vRefs = Split(sRefs, ",")

With Sheets("Sheet2")
.Unprotect
'feed in the values
For n = LBound(vRefs) To UBound(vRefs)
With Range(vRefs(n))
.Formula = Range("AG5").Formula: .value = .value
End With
Next 'n
.Protect
End With
End Sub


into the area you now have the correct values. But the values of the
area is repeated in the other areas.


Regards
Claus B.


Well.., they all use the same formula. Perhaps the formula should be
loaded into a var...

Sub Run37Hours()
Dim n&, sFormula$, sRefs$, vRefs

sFormula = Range("AG5").Formula
sRefs = "AG19, AG21:AG27, AG29:AG35, AG39:AG44, AG47, AG49,"
sRefs = sRefs & "AG52, AG55:AG60, AG63:AG66, AG69, AG73:AG78"
vRefs = Split(sRefs, ",")

With Sheets("Sheet2")
.Unprotect
'feed in the values
For n = LBound(vRefs) To UBound(vRefs)
With Range(vRefs(n))
.Formula = sFormula: .value = .value
End With
Next 'n
.Protect
End With
End Sub

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion