Posts by murthysri272

    Re: VBA Code: If not in column A then Replace


    Hi,
    Its working well.


    Actually,above code is working by considering find and results are in-between Columns A and C


    If I want to apply the same code for Column G (Find Column)and J (Result Column), How can i achieve it.


    Thanks a lot for your help



    Thank you,


    Regards,
    Sri

    Re: VBA Code: If not in column A then Replace


    Hi,
    Sorry for the confusion.


    I was talking about the below Input Box. Is there any other way can we avoid this input box to avoid the manual intervention. Instead of this Input Box, is there any way we can hard-code the columns like "P1:Q17"?


    Sri (Application.InputBox("Select the criteria.", Type:=8))


    Thank you,



    Regards,
    Sri

    Re: VBA Code: If not in column A then Replace


    Hi,
    The code you have provided is working fine.


    Okay,
    If I want to perform the same scenario for multiple replaces? can i do That?


    Like as below:


    If "E10090" found in column G then result "KAXN" in Column J
    If "E10091" found in column G then result "KBAN" in Column J
    If "E10092" found in column G then result "KVCN" in Column J
    If "E10093" found in column G then result "KJUY" in Column J
    If "E10094" found in column G then result "KAKN" in Column J


    Can i achieve these kind of replacements in VBA? If Yes, Please provide me some sample code.



    Thanks for your help.



    Thanks and Regards,
    Sri

    Re: VBA Code: If not in column A then Replace


    Okay, Thanks for your response.


    I will try this code.


    In the meanwhile could you please let me know why below code for the same scenario is not working for all instances of columnA?


    Sub VBAX_Sri_ReplaceAnyInC(WkShtName As String, FindString As Variant, ReplaceString As Variant)
    Dim Found As Range
    Dim ColumnA As Range
    Dim FirstAddress As String

    With Sheets(WkShtName)
    Set ColumnA = Sheets(WkShtName).Range("A20:A3000")

    Set Found = ColumnA.Find(FindString)
    If Not Found Is Nothing Then
    FirstAddress = Found.Address
    Do
    Found.Offset(, 2) = ReplaceString
    Loop While Not Found Is Nothing And Found.Address <> FirstAddress
    End If
    End With
    End Sub
    Sub UsageExample()
    VBAX_Sri_ReplaceAnyInC "HYPERION", "E11100373", "DEF"
    End Sub

    Hi,
    Could you please help me to find the VBA code for below scenario.


    I have data in Column A, ColumnB, ColumnC.


    Check code #1234 in ColumnA. If it finds, 5678 should return in corresponding cells for Column C.
    Else
    Check code #ABCD in ColumnA. If it finds, EFGH should return in corresponding cells for Column C.


    Detailed Explanation :


    Find "ABCDE" in ColumnA (Example Range from A20 to A3000) then replace it with "FGHIJ" as a result in column C.Means, if "ABCDE" present in ColumnA of Cell A30 then result "FGHIJ" return to Column C of cell C30. ABCDE occurs in more than onetime in columnA






    Regards,
    Sri