• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Use of InputBox VS. Data entered on a cell

Gerardo Nuno

New Member
Hello everyone!
Wondering if someone can help me to use the InputBox correctly.
the below code, works ok, when entering data in cell G6.
But I want to run the code using and InputBox instead of data entry on a cell.

Any help will be highly appreciated!

Thanks in advanced,

GN
San Diego, CA (USA)



Code:
Private Sub Worksheet_Change(ByVal Target As Range)

 
    Dim ScanValue As String
    Dim LoopValue As Integer
    Dim NotMatch As Boolean
    Dim LDate As String

    LDate = Date
   
    NotMatch = False
   
    LoopValue = 7
   
   
       
    'Run the Macro when selection cell "g6" content changed
   
    If Target.Row = 6 And Target.Column = 7 Then
    Range("g6").Select
       
        'If target value not empty, find the column "C"
        If Target.FormulaR1C1 <> "" Then
           
            ScanValue = Target.FormulaR1C1
           
            'Seek Column C until any cell value is empety
            Do Until Sheets("RMA_Receiving").Range("c" & LoopValue).FormulaR1C1 = ""
           

                'if "g6" value equal to current Cx cell value, update Ix cell value as scanvalue
                If ScanValue = Sheets("RMA_Receiving").Range("c" & LoopValue).FormulaR1C1 Then
               

                    Sheets("RMA_Receiving").Range("g" & LoopValue).FormulaR1C1 = LDate
                   
                             
                       
                   
                    NotMatch = True
                   

                End If

                LoopValue = LoopValue + 1
             

            Loop

        End If
     
        If NotMatch = False Then
   
            MsgBox ("This Serial Number is incorrect or not exist, please check again!")
            Range("g6").Select
         
        End If
       
    End If
   

End Sub
 
Hi:

Your Macro is triggered when there is a change in Cell G6, why do you want an input box? what kind of data are you inputting in Cell G6? And how do you want to trigger the input box, its a chicken and egg situation the macro will trigger only if there is a change in Cell G6 and as per my understanding you want to change the value of cell G6 using an input box correct me if I am wrong.

Thanks
 
Thanks for the Reply Nebu!

Yes .... You are right!
The Data I enter are serial numbers (Unique Values).

The code was created by a partner, and specifically to run the code from cell G6.

I Am fine to ignore the G6 relation, but to input the data from InputBox considering the existing code.

Wondering, what variables/formulas should I change to make that happened?

Thanks again for your kind help!

GN



Hi:

Your Macro is triggered when there is a change in Cell G6, why do you want an input box? what kind of data are you inputting in Cell G6? And how do you want to trigger the input box, its a chicken and egg situation the macro will trigger only if there is a change in Cell G6 and as per my understanding you want to change the value of cell G6 using an input box correct me if I am wrong.

Thanks
 
Hi:

You will have to upload a sample file for better comprehension. I won't be able to recommend to you anything without seeing a sample.

Thanks
 
Hi:

You will have to upload a sample file for better comprehension. I won't be able to recommend to you anything without seeing a sample.

Thanks

Here is Mr. Nebu:
The intention is to compare Time-in and Time-out of a product that has been fixed (RMA) ... CURRENTLY IS working OK when feeding the data on point #2

What I want is to capture the serial number ('uu' on this example) trough an Input Box ..... Ideally from point 1 will go to point 2 ... and automatically I will have what I need!

I am OK to go from 1 to 3 (Ignoring step 2) to make it easier

Please let me know if this is sufficient to make my self clear or if you need to whole program.

Thanks so much Nebu :)

CycleTimTracker.jpg
 
Hi:

This is the code snippet that assigns the value entered in the input box to the range G6.

Code:
Dim i As Long

i = InputBox("Enter the Serial No:", "RMA")
Sheet1.[G6] = i

How you want to trigger the input box? One way to do this is on a button click.

Note: you will have to change the sheet index based on your work book.

Thanks
 
That make sense Nebu! ,,,, I will give a try and post-back.

Thanks so much for the Interest and to help the freshments :)

GN
 
Back
Top