Thread: rng propblem
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Per Jessen[_2_] Per Jessen[_2_] is offline
external usenet poster
 
Posts: 703
Default rng propblem

Hi

Me.Textbox100=cells(rngArr(0).row,3)
Me.Textbox101=Cells(rngArr(0).Row,5)

Me.Textbox200=cells(rngArr(1).row,3)
Me.Textbox201=Cells(rngArr(1).Row,5)


Regards,
Per

On 24 Sep., 00:29, "Patrick C. Simonds" wrote:
Thanks.

Originally I had intended to have it set the rng

* * Set rng2 = Cells(ActiveCell.Row, 1)

each time it found a NoXXX. What I need to do is set a series of TextBox
values based on those ranges

Textbox100.value = rng1(1, 3).value
Textbox101.value = rng1(1, 5).value

Textbox200.value = rng2(1, 3).value
Textbox201.value = rng2(1, 5).value

ect.

So using what you have provided how would /I populate those TextBoxes and
how would /I write data back to those locations?

"Per Jessen" wrote in message

...



Hi


I would store the the found cells in an array, like this:


Sub NextRow()
'
' Macro4 Macro
'
'This routine finds each occurance of NoXXX in column AA so that
multipage 2 of NoShowDataInput UserForm can display prior No Shows


*Dim c As Range
*Dim rngArr() As Range
*Dim rng As Range
*ReDim rngArr(0)
*On Error GoTo Done
*ActiveSheet.Columns("AA").Hidden = False
*Set c = Cells.Find(What:="NoXXX", After:=Range("AA1"),
LookIn:=xlValues, _
* * * * * * * * * * LookAt:=xlPart, SearchOrder:=xlByRows, _
* * * * * * * * * * SearchDirection:=xlNext, MatchCase:=False, _
* * * * * * * * * * SearchFormat:=False)


*If Not c Is Nothing Then
* *Do
* * * *Set rngArr(UBound(rngArr)) = c
* * * *ReDim Preserve rngArr(UBound(rngArr) + 1)
* * * *Set c = Cells.Find(What:="NoXXX", After:=Range(c.Address),
LookIn:=xlValues, _
* * * * * * * * * * LookAt:=xlPart, SearchOrder:=xlByRows, _
* * * * * * * * * * SearchDirection:=xlNext, MatchCase:=False, _
* * * * * * * * * * SearchFormat:=False)
* *Loop Until c.Address = rngArr(0).Address
*End If
*ReDim Preserve rngArr(UBound(rngArr) - 1)
*Set rng = rngArr(UBound(rngArr))
*Debug.Print rng.Address
Done:
* *ActiveSheet.Columns("AA").Hidden = True
End Sub


Regards,
Per- Skjul tekst i anførselstegn -


- Vis tekst i anførselstegn -