Need a book? Engineering books recommendations...

Return to index: [Subject] [Thread] [Date] [Author]

RE: Simple Excel Visual Basic question.

[Subject Prev][Subject Next][Thread Prev][Thread Next]



This is a small example of a range manipulation I use in one of my programms.

The cells are defined numerically (1,1) instead of using the address notation “A1”

In the example below, for example Cell (6,12) corresponds to Cell “L6”


For i = 1 To Nwind

    H = Worksheets("Cylinder").Cells(i + 5, 12).Value / 1000


    Select Case H

    Case Is < zmin

        vm = alfa1 * vref

        IV = beta1

    Case Else

        vm = alfa2 * vref * (H / 10) ^ expo

        IV = beta2 * (H / 10) ^ (-expo)

    End Select


    QB = ro / 2 * vm ^ 2 * (1 + 6 * IV)

    Worksheets("Cilinder").Cells(i + 5, 22).Value = QB

Next i


I hope this is helpful



From: Casey K. Hemmatyar [mailto:khemmatyar(--nospam--at)]
Sent: zaterdag 8 april 2006 00:23
To: seaint(--nospam--at)
Subject: Simple Excel Visual Basic question.


I've got a Excel Visual Basic question.

I know how to write a simple program which can manipulate a single cell

and the following shows it:


Sub test()

a = ActiveSheet.Range("thickness")

b = ActiveSheet.Range("length")

e = a * b

ActiveSheet.Range("force") = e * 10

End Sub


However I'd like to manipulate a "range" rather than a "cell".

That means for instance I'd like to manipulate the "range" that consists of A1, A2, A3 & A4 which can all in the same column or row.

The reason for this is that I'd like to iterate a series of complex calculations.


I appreciate your input.


Casey Hemmatyar, PE

Southern California