PDA

View Full Version : Solved: cell.adress question



white_flag
01-26-2011, 01:33 AM
'morning

I have this code:

Dim a1 As Long, b2, c3
For i = 1 To 4
If Me.Controls("CheckBox" & i) = True Then
If Me.Controls("TextBox" & i & "a").Text = vbNullString Then Me.Controls("TextBox" & i & "a").Text = 0
If Me.Controls("TextBox" & i & "b").Text = vbNullString Then Me.Controls("TextBox" & i & "b").Text = 0
If Me.Controls("TextBox" & i & "c").Text = vbNullString Then Me.Controls("TextBox" & i & "c").Text = 0
Me.Controls("CheckBox" & i).Caption = Replace((Application.Evaluate(Replace(Me.Controls("TextBox" & i & "c").Text, ",", ".") & "*(1+" & Replace(Me.Controls("TextBox" & i & "a").Text, ",", ".") & "/100)+(" & Replace(Me.Controls("TextBox" & i & "b").Text, ",", ".") & "/60*" & Replace(Me.Controls("TextBox51").Text, ",", ".") & ")")), ".", ",") & " €/m²"
a1 = Application.Evaluate(Replace(Me.Controls("TextBox" & i & "a").Text, ",", "."))
b2 = Application.Evaluate(Replace(Me.Controls("TextBox" & i & "b").Text, ",", "."))
c3 = Application.Evaluate(Replace(Me.Controls("TextBox" & i & "c").Text, ",", "."))
Formula_A = "(" & Formula_A & "+" & c3 & "+" & b2 & "+" & a1 & ")"
Sheets(strSheetName).Range("F" & i + 1) = a1
Sheets(strSheetName).Range("G" & i + 1) = b2
Sheets(strSheetName).Range("H" & i + 1) = c3
Sheets(strSheetName).Range("I" & i + 1) = a1.adress

End If
Next


I like to know how to be put the adress of the cell a1, b2, c3. to have an expresion in excel file based on cell location

thank you

Bob Phillips
01-26-2011, 02:01 AM
I think you mean


Sheets(strSheetName).Range("F" & i + 1) = Range("A1").Address


but why not just use


Sheets(strSheetName).Range("F" & i + 1) = "A1"

white_flag
01-26-2011, 02:19 AM
yes, this is correct. Bob, thank you very much