none
Reference to cells and userform elements RRS feed

  • Question

  • Hi,

    I have a sheet with 

    column A some strings like  a.cells(i,j), where a is the name of one sheet in VBA, i, j row and column numbers,
    column B some strings like    a.cells(i,j) & " " & a.cells(i1,j1) ,
    column C some strings like userfom.textbox1, where I have the name of the userform and the textbox,

    In my program I must get the content of the cells and the textboxes .

    With what code can I get these contents?

    Saturday, January 21, 2017 4:15 PM

All replies

  • I am not really sure that I am understanding you question. However, insert dot and value after the references to extract the value like the following. However, the dot value is not generally required because it is the default.

    a.cells(i,j).value

    Also, because you are obviously a novice, I recommend the Community forum at the following link.

    https://answers.microsoft.com/en-us/msoffice/forum/msoffice_excel?sort=lastreplydate&dir=desc&tab=threads&status=statusval&mod=&modAge=&advFil=&postedAfter=&postedBefore=&threadType=threadtypeval&tm=1485041050968


    Regards, OssieMac

    Saturday, January 21, 2017 11:27 PM
  • I have a Excel project with some user forms and sheets.
    I want get values from different sheets cells and user form elements. It has many sets of these values and the user must have the possibility to change easy the source of data.
    For these reason I have a sheet where are located these parameters.

    I want a code to get data from a cell or a user form element, whose address is this sheet.

    For ex.

    In right is an other reference to cells, where a1 is a second sheet

    with these function

    Function referinta(s1 As String, s2 As String)
    Dim R1 As Range
    Set R1 = Sheets(s1).Cells.Range(s2):
    referinta = R1.Value
    End Function


    we have the value of the cells described with these two parameters s1, s2, where s1 is the sheet name, s2 the cell location

    I want in the similar way get the values from an user form elements, like userfom.textbox1 and a cell reference like   a.cells(i,j) & " " & a.cells(i1,j1) 

    link to the file

    https://drive.google.com/open?id=0B16Q4Z9FkFzhOUh4eGlYVUMwZnM


    • Edited by csaba114 Sunday, January 22, 2017 7:36 AM
    Sunday, January 22, 2017 7:29 AM