Solved

Paste Values

Posted on 2011-09-03
6
136 Views
Last Modified: 2012-08-14
Hello all, I have this code below.  What I need iis a vba code that will find the value of the variable StrData in sheet13 column A, then if sheet5 cell a25 is not blank, then place an "X" in the matching row in Column H.

For example is StrData=KCTT, then in sheet 13, find KCTT, then check to see if sheet 5 cell a25 is not blank, if not blank then place an "X" on column H on the same row as KCTT.
0
Comment
Question by:sandramac
6 Comments
 
LVL 2

Expert Comment

by:jnfsmile
ID: 36478781
You wrote you have code?...

Here is a subroutine you can use from your code. I hope it serves your needs.

Sub doMiracle(strData)
    Dim found As Range
    Set found = Sheets("Sheet13").Range("A:A").Find(strData)
    If Not found Is Nothing Then
        If Sheets("Sheet5").Range("A25") <> "" Then Sheets("Sheet13").Range("H" & Chr(64 + found.Row)).Value = "X"
    End If
End Sub

Open in new window

0
 

Author Comment

by:sandramac
ID: 36478947
Hello I had to change a couple of values on the code but it will still not put the X, which I had to change to Pass here is what I have, it will not input the PASS when conditions are met

Dim found As Range
    Set found = Sheets("Sheet13").Range("A:A").Find(StrData2)
    If Not found Is Nothing Then
        If WS.Range("X44") <> "" Or WS.Range("X45") <> "" Then Sheets("Sheet13").Range("H" & Chr(64 + found.Row)).Value = "PASS"
    End If
0
 

Author Comment

by:sandramac
ID: 36479184
Hello, tried to play around with the code but still having trouble, looking for some more help please.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 41

Expert Comment

by:dlmille
ID: 36479618
Ok - we need to know if its actually finding anything, or if there's problem with setting the value.  If not finding anything, you'll note I've added a few more parameters to the find method - what <= is what you're looking for, lookIn <= xlValues (if a constant) or xlFormulas (if you're trying to find text in a formula),a nd finally, what might be the problem lookAt <= xlWhole looks for a whole word match (beware special characters in your spreadsheet!), and xlPart will search for the strData in the text and find a match if its contained in a cell in column A.

Or, your problem could be the Chr(64 + found.Row) = I've never seen this application before...

Column H same row would be sht.range("H" & found.row)!

I wrote the following with some adjustments to match your original question, but with your most recent post.  

Here's the code:
 
Sub findAndMark()
Dim found As Range
Dim WS As Worksheet
Dim findWS As Worksheet
Dim wkb As Workbook
Dim strData As String

    Set wkb = ActiveWorkbook
    Set WS = wkb.Sheets("Sheet5")
    Set findWS = wkb.Sheets("Sheet13")
    
    strData = "KCTT"
    
    Set found = findWS.Range("A:A").Find(strData)
    If Not found Is Nothing Then
        If WS.Range("X44") <> "" Or WS.Range("X45") <> "" Then
            findWS.Range("H" & found.Row).Value = "PASS"
        End If
    End If
    
End Sub

Open in new window

See attached.

Good luck!

Dave
findAndMark-r1.xls
0
 
LVL 29

Expert Comment

by:gowflow
ID: 36484899
Hi Sandramac
Is this what your looking for ? Pls goto sheet 13 and activate the button Find in Sheet13 and Update Col H. Please enter any occurence and check the results.

Pls feel free to advise your comments.
gowflow
Paste-Values.xls
0
 
LVL 29

Accepted Solution

by:
gowflow earned 500 total points
ID: 36484920
Opps you said place an X !!! I placed the value of the StrData. Here is the X in this version
gowflow
Paste-Values.xls
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now