PDA

View Full Version : Where is it the written cell????



Matrox
01-23-2007, 01:08 PM
Hi,

My question must be quite easy to you guys.
I have a question cell?s range from B7 to AK16 and the person can write down in any place of this range...
I need to put in my VBA Code.... where is the written cell? :dunno
and put on strfnd = .Range("???").Value


Thanks a lot.

CBrine
01-23-2007, 01:17 PM
Matrox,
Is it just a single cell? So in the entire volume of B7:AK16, only 1 cell will be populated? And you want to return the value of this cell to strfnd.

Cal

mdmackillop
01-23-2007, 01:17 PM
Is this the sort of thing you're after?
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Not Intersect(Target, Range("B7:AK16")) Is Nothing Then
MsgBox "User entered " & Target.Formula & " in cell " & Target.Address(0, 0)
End If
End Sub

CBrine
01-23-2007, 01:23 PM
I was thinking of it from a little different of a perspective then md. Figured I would post in case I'm right. This will find any value in the selected range and assign it to strfnd.


Dim cell As Range, Count As Integer
For Count = 7 To 16
For Each cell In ActiveSheet.Range("B" & Count & ":AK" & Count)
If Len(cell) <> 0 Then
strfnd = cell.Value
End If
Next cell
Next Count

mdmackillop
01-23-2007, 01:39 PM
Hi Cal
That will return the data in the last non-blank cell

Matrox
01-24-2007, 05:42 AM
Hi mdmackillop and CBrine.

After read you answers (thanks) I see some problems to me.. As this Excell is a questionary ,the cell I need are on Plan3. I got all informations from Plan1(Data) and Plan2(Inmages). Into my VBA code I Set oWorkSheet = oWorkbook.Worksheets("fl 3") to use now the page 3 and how can I use those fl3 infos into that code you sent guys?
Another question.... As you mentioned guys, My range B7 till AK16 is free
to write in any place, and should be the answer of my question. Need to get the whole answer and put together in a one string. So what I thought was wrong, right? strfnd = .Range("???").Value ???:doh:

vbmenu_register("postmenu_87803", true);

mdmackillop
01-24-2007, 05:48 AM
Hi Matrox
Can you post your workbook? Use Manage Attachments in the Go Advanced section.

Matrox
01-24-2007, 06:22 AM
Hi,

Here It?s a example of my workbook... All information goes to my acess database, except imagens that I save in a directory.
All infos and helps I got from this good forum :thumb

Paleo
03-12-2007, 06:12 PM
Oi Matrox,

podes postar o que precisas em portugu?s mesmo? Eu explico para eles e fica mais f?cil.