1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

to Find a word in a row and display the word that entered through text box

Discussion in 'Business Applications' started by Aishwariya, Jun 12, 2013.

Thread Status:
Not open for further replies.
  1. Aishwariya

    Aishwariya Thread Starter

    Joined:
    Jun 12, 2013
    Messages:
    1
    Hii..

    I need to write a macro to display the word entered through the text box. I have a column with a word say "ABC" in the row number 3. First i need to search that column, and i have a word say "No" in the work sheet . So i need to display the text(entered through text box) in the column "ABC" whereever i have the row with text "No".

    I have written using the cells and the numbers, but when i dynamically change it to another column, this does not work.

    Sub Gen()
    TextBox1 = InputBox("Please Enter the text")
    If TextBox1 <> "" Then

    For j = 4 To ActiveSheet.UsedRange.Rows.Count
    If Cells(j, 10) = "No" Then
    If IsEmpty(Cells(j, 36).Value) Then
    Cells(j, 36).FormulaR1C1 = TextBox1
    Cells(j, 36).Select
    With Selection
    .HorizontalAlignment = xlGeneral
    .VerticalAlignment = xlBottom
    .WrapText = True
    .Orientation = 0
    .AddIndent = False
    .IndentLevel = 0
    .ShrinkToFit = False
    .ReadingOrder = xlContext
    ' .MergeCells = False
    End With
    End If
    End If
    Next j
    Else
    MsgBox ("The value cannot be NULL")
    End If
    End Sub
     
  2. Rollin_Again

    Rollin_Again

    Joined:
    Sep 4, 2003
    Messages:
    4,912
    I'm still unclear what you are asking for. Is it possible to upload a sample workbook showing exactly what you want the macro to do?

    Rollin
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1101050

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice