View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default OFFSET LOOKUP function in VBA?

Hi,

Am Thu, 3 Oct 2013 13:59:08 -0700 (PDT) schrieb
:

In the example code below the first offset enters data into column A titled "Test Date"; offset 2 enters to column B titled "Test Time"; offset 3 enters to column C titled "name".


name your headers like your activeX objects, e.g. textbox is named
"txtTestDate" so name the header "TestDate" and then try:

Dim FERow As Long 'First empty row
Dim c As Range

FERow = Worksheets("Data").Cells(Rows.Count, 1).End(xlUp).Row + 1
With Me.txtTestDate
Set c = Worksheets("Data").Range("1:1") _
.Find(Right(.Name, Len(.Name) - 3), LookIn:=xlValues)
Cells(FERow, c.Column) = CDate(Me.txtTestDate.Value)
End With
and repeat the with statement for all your activeX objects


Regards
Claus B.
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2