Sub SheetSetup() Sheets("Template").Select' go to template sheet NumberofRowsToSetup = [b15] + 8 '''' NumberofRowsToSetup = what ever number is in B15 on the sheet+8 Numberofdropdown = [b16] NumberofDateSetup = [a16] NumberofFieldSetup = [o16] Call ColunmWidth ......I'm new at excel an using square brackets in this way might be incorrect, but the thing I don't understand is it work awesome on the computer I created the program on
VB: Arr(1 To 4, 1 To 4) If you like these VB formatting tags please consider sponsoring the author in support of injured Royal MarinesIs this two one-dimensional arrays, having a total of 8 elements?
VB: Private Sub ArrayCountTest() Dim Arr() As Integer Redim Arr(0 To 3, 0 To 3) Dim n As Integer n = 0 For x = 0 To 3 For xx = 0 To 3 Arr(x, xx) = n n = n + 1 Debug.Print "Dim1:" & x Debug.Print "Dim2:" & xx Debug.Print "Count:" & n Debug.Print "-" Next xx Next x End Sub If you like these VB formatting tags please consider sponsoring the author in support of injured Royal MarinesThe resulting count for n is 16 (square of 4), but I think it could be the result of the way I programmed the test. The reason I have a hard time accepting this result is because I liken it to physical dimensions. Take length times width and you've squared something, length times width times height and you've cubed it. I learned arrays in VBA can have up to SIXTY dimensions!! What does Excel do after the third dimension!? (head explode)
varRegResults = Application.WorksheetFunction.LinEst(Range(Cells(2, 4), Cells(2, 4).End(xlDown)), Range(Cells(2, 8), Cells(2, 8).End(xlDown)), False, True) varSlope = varRegResults(1, 1) varRSquared = varRegResults(3, 1) varError = varRegResults(2, 1) varF = varRegResults(4, 1)The slope matches perfectly, but the R value does not. Note that I did force the line through zero in the VBA and manually. I am absolutely certain that the data is identical in both cases. Using Watch and Locals, I can see that the R2 is just plain a different value! I'm using Excel 2003. It seems though, that there are some major problems with Excel's regression procedures. (For example, see http://www.daheiser.info/excel/main/section9.pdf).
Sub Sqrt() Dim S As Integer Dim N As Integer Dim ctr As Integer S = InputBox("Enter Number") Do Until ctr = S ^ (1 / 2) N = S / 2 If ctr = (1 / 2) * (N + S / N) Then MsgBox (ctr) Else N = ctr End If Loop End SubWhat do I need to change? I also want to show the answer with a Message Box. Thank you!
VB: Option Explicit 'Correction Factor calculations for the LMTD 'source Robert R Serth, heat Transfer principles and applications. 'For any number of shell side passes and any even number of tube side passes as follows 'LMTD is calculated as ' N is the nymber of shell side passes Function Calcfc(Tis As Double, Tos As Double, Tit As Double, Tot As Double, N1 As Double, N2 As Double) As Double 'Correction Factor calculations for the LMTD 'source Robert R Serth, heat Transfer principles and applications. 'For any number of shell side passes and any even number of tube side passes as follows ' N is the nymber of shell side passes 'R P and alpha are ratios used to calculate the correction factor Dim R As Double, P As Double, S As Double, alpha As Double, n As Double Dim num As Double, den As Double, F As Double 'the numerators and denominators of the functions to ease writing the functions 'Where Ta (Tis)= inlet temperature of the shell-side fluid 'Tb (Tos) = outlet temperature of the shell-fluid 'ta (Tit= inlet temperature of the tube side fluid 'tb(Tot) = oulet temperature of the tube side fluid R = (Tis - Tos) / (Tot - Tit) P = (Tot - Tit) / (Tis - Tit) n = N1 * N2 alpha = ((1 - R * P) / (1 - P)) ^ (1 / n) If R = 1 Then S = P / (n - (n - 1) * P) num = (S * 2 ^ 0.5) den = (1 - S) * WorksheetFunction.Ln((2 - S * (2 - 2 ^ 0.5)) / (2 - S * (2 + 2 ^ 0.5))) F = num / den Else alpha = ((1 - R * P) / (1 - P)) ^ (1 / n) S = (alpha - 1) / (alpha - R) num = ((R ^ 2 + 1) ^ 0.5) * WorksheetFunction.Ln((1 - S) / (1 - R * S)) den = (R - 1) * WorksheetFunction.Ln((2 - S * (R + 1 - (R ^ 2 + 1) ^ (1 / 2))) / (2 - S * (R + 1 + (R ^ 2 + 1) ^ (1 / 2)))) F = num / den End If Calcfc = F End Function If you like these VB formatting tags please consider sponsoring the author in support of injured Royal MarinesAny body with any idea.