Solved

Paste Values

Posted on 2011-09-03
6
135 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
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.

744 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

13 Experts available now in Live!

Get 1:1 Help Now