+ Reply to Thread
Results 1 to 2 of 2

macro to run a macro for evrey cell in column depending upon valuein cell

Hybrid View

  1. #1
    Registered User
    Join Date
    01-08-2014
    Location
    Pune India
    MS-Off Ver
    Excel 2010
    Posts
    3

    macro to run a macro for evrey cell in column depending upon valuein cell

    hi,
    i am having an excel sheet used to inward the material.i have to enter its name size least count make id etc.I want a macro which will depending upon the details entered in the cell in column , open the respective file from a specified location i.e. network drive S:. i am using column A from 501 to 1200. it should not overwrite the previous file.
    i think looping is required but unable to do that.
    Please help me.
    regards

  2. #2
    Forum Contributor mongoose36's Avatar
    Join Date
    06-10-2013
    Location
    Lincoln
    MS-Off Ver
    Excel 2013
    Posts
    389

    Re: macro to run a macro for evrey cell in column depending upon valuein cell

    This should get you started.

    Sub TestSub()
    
    Dim ws As Worksheet
    Dim myRange As Range, LastRow As Range
    Dim wb As Workbook
    Dim nwb As Workbook
    
    Set wb = ThisWorkbook
    Set nwb = "path to othe workbook"  ' e.g. C:\Folder1\Folder2\File.xlsx
    
    Set ws = Worksheets("Sheet Name")  ' replace with your sheet Name
    
    With ws
        Set LastRow = .Range("A" & Rows.Count).End(xlUp) 'finds last filled cell in the "A" column
    End With
    
    Set myRange = Range("A1", LastRow) 'sets a new range using the first cell "A1" and the last cell form above
    
    For Each Cel In myRange
        If Cel.Value = "your value here" Then
            nwb.Open
        End If
    Next Cel
    
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Use same VBA macro, depending on the Cell Name
    By tharindudk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-30-2014, 06:07 PM
  2. Return a valuein one cell dependant on value of another
    By davidcrawt in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 09-04-2013, 08:19 PM
  3. Need Macro to Run Depending on Cell Value
    By srmichael in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-12-2012, 04:20 PM
  4. Macro that is column specific & changes cell color depending on cell contents
    By zurispowell in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-25-2012, 05:03 PM
  5. Macro run depending on cell value
    By cmb80 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-17-2011, 08:12 AM

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