dividing cells range
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

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

Dividing Cells in a Range

resolvedResolved · Medium Priority · Version 2007

replyReply Wed 18 May 2011, 15:57Delegate Chris said...

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

For upcoming training course dates see: Pricing & availability

replyReply Thu 19 May 2011, 17:19Delegate Chris said...

RE: Dividing Cells in a Range

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

 

Please browse our web site to find out more about
excel-training-course and other Microsoft training courses.

Excel tip:

The Easiest Way to See a Sum or Average in Excel 2010

Did you know the quickest and most simple way of working out the average or sum of a set of numbers?

Highlight numbers in cells or type some numbers in cells and then look at the status bar at the bottom of the window. Here you will see a display of the average of the numbers, as well as a count of the cells and the sum of these cells.

View all Excel hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard