LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default How to use the "found" cellvalue in VB.

Is there a reason you're searching for SDorderno, but using "myvalue" in the
inputbox?

I'm not sure if this does what you want, but maybe it'll help:

Option Explicit
Sub testme()

Dim SDorderno As Variant
Dim Title As String
Dim myValue As Variant 'long '????
Dim Message As String
Dim FoundCell As Range

Message = "Fuctuurinvoer voor Salesordernr."
Title = "Demo InputBox"
SDorderno = InputBox(Message, Title, Default)

With ActiveSheet.Range("B:B")
Set FoundCell = .Cells.Find(What:=SDorderno, _
After:=.Cells(.Cells.Count), LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
End With

If FoundCell Is Nothing Then
'do nothing
MsgBox "not found"
Else
FoundCell.Offset(0, 1).Copy _
Destination:=Worksheets("Invoerscherm").Range("k10 ")
End If
End Sub




Frank Groenendijk wrote:

Hi there, please, help required with VB
I want to use a macro to copy the cell-contents from a row, found with the
"Find" command using following code: (using an inputbox to get the
Find-value).

Dim SDorderno, Title, MyValue
Message = "Fuctuurinvoer voor Salesordernr."
Title = "Demo InputBox"
MyValue = InputBox(Message, Title, Default)

Columns("B:B").Select
Selection.Find(What:=SDorderno, After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Activate
ActiveCell.Select
ActiveCell.Offset(0, 1).Activate
Application.CutCopyMode = False
Selection.Copy
Sheets("Invoerscherm").Select
Range("K10").Select
ActiveSheet.Paste

"SDorderno" contains the value to find in column B.
However, the cell with the matching data is not activated. Instead, the
column B remains activated
How can I get the required cell to be activated?
Tx.
Frank


--

Dave Peterson
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
how do I turn on document "editing time" found on advanced proper. cancer711 Excel Discussion (Misc queries) 2 May 24th 08 02:52 PM
Search for the word "continued", if found, delete that row + 10 rows above jriendeau5[_4_] Excel Programming 0 November 5th 04 03:00 PM
Getting "compile error" "method or data member not found" on reinstall Bp Excel Programming 1 April 23rd 04 04:42 PM


All times are GMT +1. The time now is 09:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"