Solved

Paste Values

Posted on 2011-09-03
6
142 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
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 30

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 30

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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

739 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