Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

dividing cells range

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Dividing Cells in a Range

Dividing Cells in a Range

ResolvedVersion 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

RE: Dividing Cells in a Range

I did it myself! I used a function module to do the calculation. :D

 

Training courses

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
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Excel tip:

Cycling through Absoulte cell references

If you are working with formulas in excel and need to convert your formula to an absolute formula, instead on manually adding in the $dollar signs you can highlight the specific part of your formula and press the F4 key.

You can cycle through all the absolute options by pressing the button (up to four times)

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.11 secs.