98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Dividing Cells in a Range
Dividing Cells in a Range
Resolved · Medium Priority · Version 2007
Chris has attended:
Excel VBA Intro Intermediate course
Dividing Cells in a Range
NB/ Question submitted by agreement with and allocated to Stephen
How do I divide by 100 the Cells in a Range that I have moved across? Here is my code for this particular section:
Sub CopyData()
Dim intRowCount As Integer
Dim intColumnCount As Integer
Dim intTargetRowCount As Integer
Dim strSourceRangeStart As String
Dim strSourceRangeFinish As String
Dim strTargetRangeStart As String
Dim strTargetRangeFinish As String
Dim strSourceRange As String
Dim strTargetRange As String
intTargetRowCount = 2
For intRowCount = 1 To 64
If Sheets("RfC").Range("A5").Cells(intRowCount - 3, 1).Value = "" _
And Not Sheets("RfC").Range("A5").Cells(intRowCount, 2).Value = "" Then
strSourceRangeStart = Sheets("RfC").Range("A5").Cells(intRowCount, 1).Address
strSourceRangeFinish = Sheets("RfC").Range("A5").Cells(intRowCount, 25).Address
strTargetRangeStart = Sheets("Table").Cells(intTargetRowCount, 2).Address
strTargetRangeFinish = Sheets("Table").Cells(intTargetRowCount, 26).Address
strSourceRange = strSourceRangeStart & ":" & strSourceRangeFinish
strTargetRange = strTargetRangeStart & ":" & strTargetRangeFinish
Sheets("Table").Range(strTargetRange).Value = _
Sheets("RfC").Range(strSourceRange).Value
Sheets("Table").Range(strTargetRange).Value = (Sheets("Table").Range(strTargetRange).Value) / 100
intTargetRowCount = intTargetRowCount + 1
End If
Next intRowCount
End Sub
Training information:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:Copying Formulae QuicklyThere is a quicker way of copying a formula down a column. |