vba - Print value of a header into a TextBox -
i'm trying loop through range of cells until find cell i'm looking for. when found, want note column of cell , print heading, in row 2. code like:
for each x in sheets("sheet1").range("a3:ak20") if x.value = sectiontbx.text 'print value of specific row in column x.activate msgbox(cells(2, activecell.column)) end if next
i have tried using &activecell.column
, quotations , saving activecell.column variable etc. not work, though managed correctly print out msgbox (activecell.column)
.
i tried incuding .end(xlsup).offset(-1,0)
reason, cell chose top cell vary (i'm implementing search , return macro else's spreadsheet table, think may have formatted badly , that's affecting xlsup somehow.)
how can print value of header textbox in user form? able print "true" box. assume data type issue couldn't solve it.
using find loop faster iterating through each cell individually:
dim rngfound range dim strfirst string sheets("sheet1").range("a3:ak20") set rngfound = .find(sectiontbx.text, .cells(.cells.count), xlvalues, xlwhole) if not rngfound nothing strfirst = rngfound.address msgbox .parent.cells(2, rngfound.column).text set rngfound = .find(sectiontbx.text, rngfound, xlvalues, xlwhole) loop while rngfound.address <> strfirst end if end
Comments
Post a Comment