insectpugilist
New Member
- Joined
- Jul 17, 2011
- Messages
- 1
Hi, I'm new to programming with VB though I have some experience with C. Well, I should post my commented code first before I ask.
I got the
from the [microsoft website](http://support.microsoft.com/kb/291308). My question is, do I need to do this every time I want to point to another sheet? Or is there another way to tell the program to refer to another sheet (in the same workbook)?
Am I allowed in VB to use the variable effdia as a number to be used in Cells(effdia, 2)? Basically I want to know if I'm doing it right so far... Thanks.
Code:
Dim dlp, ap, lat, effdia, conversionfactor As Double
Dim count, bodypart As Integer
bodypart = Cells(2, A).Value 'assigns value in excel sheet to variable
dlp = Cells(4, A).Value
ap = Cells(5, A).Value
lat = Cells(6, A).Value
If lat = 0 And bodypart = 1 Then
effdia = Math.Round(ap) 'rounds to nearest integer
Application.Goto ActiveWorkbook.Sheets("head").Cells(effdia, 2)
'goes to a certain row in "head" (a different sheet)
conversionfactor = Cells(effdia, 2).Value 'copies value into conversionfactor
ElseIf lat <> 0 And bodypart = 1 Then
effdia = Math.Round(Math.Sqr(ap * lat)) 'I'm allowed to do this right?
Application.Goto ActiveWorkbook.Sheets("head").Cells(effdia, 5)
conversionfactor = Cells(effdia, 5).Value
End If
I got the
Code:
Application.Goto ActiveWorkbook.Sheets("head").Cells(effdia, 2)
from the [microsoft website](http://support.microsoft.com/kb/291308). My question is, do I need to do this every time I want to point to another sheet? Or is there another way to tell the program to refer to another sheet (in the same workbook)?
Am I allowed in VB to use the variable effdia as a number to be used in Cells(effdia, 2)? Basically I want to know if I'm doing it right so far... Thanks.