Solved

Paste Values

Posted on 2011-09-03
6
139 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 42

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

821 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