Consulting

Results 1 to 2 of 2

Thread: VBA for Row Difference

  1. #1
    VBAX Regular
    Joined
    Dec 2014
    Posts
    30
    Location

    VBA for Row Difference

    Need to write a VBA or below..

    My Macro sheet name which have Button is known as Summary
    Summary Workbook have Command button..
    Now When user clicks this command button then below should be done..
    1) After button click Vba should ask for the other file to be open
    2)Once user select file path Vba should open the file & ask for sheet name on which user want to work.
    3) Once sheet is selected & active then VBA should consider two columns
    Column "J" & Column "M" and check the row difference and highlight it.
    Attached is the Summary workbook & Input workbook.
    Note - The Input workbook and sheet name may be by any name..
    User should manually select Workbook & Sheet in it
    Can anyone please suggest on this
    Attached Files Attached Files

  2. #2
    VBAX Regular
    Joined
    Dec 2014
    Posts
    30
    Location
    I written the code which is running fine..
    Below code will Ask user to open filename & then ask to type which sheet user wants to work..
    I am waiting that how do i now consider column J & column M and find row difference..
    Private Sub CommandButton1_Click()
    ''This will prompt user to open the excel file which user wants to work on..
    Dim strFileToOpen As String
    strFileToOpen = Application.GetOpenFilename _
    (Title:="Please choose a file to open", _
    FileFilter:="Excel Files *.xls* (*.xls*),")
    If strFileToOpen = "False" Then
    MsgBox "No file selected.", vbExclamation, "Sorry!"
    Exit Sub
    Else
    Workbooks.Open Filename:=strFileToOpen
    End If
    ''''
    Dim strName As String, ws As Worksheet

    strName = Application.InputBox("Please enter the Sheet name")

    strName = strName

    On Error Resume Next

    Set ws = Worksheets(strName)

    If Not ws Is Nothing Then 'sheet exist

    Sheets(strName).Select

    Else 'sheet does not exist or the entry is otherwise invalid

    MsgBox "The sheet doesn't exist or you entered the name incorrectly"

    End If

    Set ws = Nothing
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •