Results 1 to 7 of 7

Select column A's cell in relation to the row that macro button was clicked on?

Threaded View

xlyfe Select column A's cell in... 04-09-2013, 11:03 AM
AndyLitch Re: Select column A's cell in... 04-09-2013, 11:15 AM
xlyfe Re: Select column A's cell in... 04-09-2013, 11:44 AM
Norie Re: Select column A's cell in... 04-09-2013, 11:23 AM
xlyfe Re: Select column A's cell in... 04-09-2013, 11:40 AM
Norie Try this, which you should... 04-09-2013, 12:03 PM
xlyfe Re: Select column A's cell in... 04-09-2013, 12:24 PM
  1. #5
    Forum Contributor
    Join Date
    03-21-2013
    Location
    USA
    MS-Off Ver
    365
    Posts
    163

    Re: Select column A's cell in relation to the row that macro button was clicked on?

    Quote Originally Posted by Norie View Post
    How did you create the buttons?

    If it's a Forms button you could use something like this.
    Dim rng As Range
    Dim btn As Shape
    
        Set btn = Worksheets("Sheet1").Shapes(Application.Caller)
        
        Set rng = Worksheets("Sheet1").Cells(btn.TopLeftCell.Row, 1)
    Mind you having hundreds of buttons might not be a good idea.
    Here is the whole button. And yes, it is a forms button.

    Sub CreateSheet()
    
    Dim sPath As String, sSheetName As String
    
    sSheetName = ActiveSheet.Name
    sPath = ThisWorkbook.Path & "\" & Sheets(ActiveSheet.Name).Range("A3").Value
    
    Workbooks.Add ("\\twsbs01\common$\TIMBERWORKS JOB FILES\CURRENT JOBS\CONSTRUCTION RELEASE DATABASE\CRE TEMPLATES\cre template.xlsm")
    ActiveWorkbook.SaveAs sPath, 52
    Range("C2:F2").FormulaR1C1 = "='[cre database.xlsm]" & sSheetName & "'!R1C2"
    Range("C3:F3").FormulaR1C1 = "='[cre database.xlsm]" & sSheetName & "'!R1C5"
    
    End Sub
    Edit Post... I guess I'm just not sure how to incorporate what you suggested into what I've written so far. :/

    Thank you for taking your time to help me out.
    Last edited by xlyfe; 04-09-2013 at 12:02 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1