+ Reply to Thread
Results 1 to 17 of 17

String and Value workbook reference

Hybrid View

jsp_1951 String and Value workbook... 10-15-2013, 05:33 PM
Bilbo_Baggins Re: String and Value... 10-15-2013, 07:00 PM
alansidman Re: String and Value... 10-15-2013, 07:50 PM
jsp_1951 Re: String and Value... 10-15-2013, 09:13 PM
Bilbo_Baggins Re: String and Value... 10-15-2013, 10:09 PM
Bilbo_Baggins Re: String and Value... 10-15-2013, 09:26 PM
jsp_1951 Re: String and Value... 10-16-2013, 11:11 AM
Bilbo_Baggins Re: String and Value... 10-15-2013, 10:18 PM
Norie Re: String and Value... 10-16-2013, 11:25 AM
jsp_1951 Re: String and Value... 10-16-2013, 11:42 AM
Bilbo_Baggins Re: String and Value... 10-16-2013, 11:36 AM
jsp_1951 Re: String and Value... 10-16-2013, 11:55 AM
Norie Re: String and Value... 10-16-2013, 11:50 AM
Bilbo_Baggins Re: String and Value... 10-16-2013, 06:42 PM
jsp_1951 Re: String and Value... 10-16-2013, 10:31 PM
Bilbo_Baggins Re: String and Value... 10-16-2013, 06:45 PM
Norie Re: String and Value... 10-16-2013, 07:08 PM
  1. #1
    Registered User
    Join Date
    10-24-2011
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: String and Value workbook reference

    I guess I don't understand, I am familiar with sheet and cell reference in a spreadsheet but I can't seem to apply the concept in a macro. Below is the macro that I use to select a subst of the colums. When I want to select different colums, I edit the col names below. These names are used in several different way in later macros, so I need to edit the there as well.



    '
    ' Copy Las Data to QCData sheet
    '
    '
        Sheets("LAS Load").Select
        Cells.Select
        Selection.Copy
        Sheets("QCData").Select
        Range("A1").Select
        ActiveSheet.Paste
    ' Rename ~A to CutOff
        Range("A1").Select
        Application.CutCopyMode = False
        ActiveCell.FormulaR1C1 = "CutOff"
    '
    ' This section deletes columns not needed from raw data
    ' Add/change mnemonics below to specify channels to be saved
    '
    Sheets("QCData").Select
    Dim i As Long
    For i = Cells(1, Columns.Count).End(xlToLeft).Column To 1 Step -1
    If Cells(1, i) <> "CutOff" _
    And Cells(1, i) <> "TIME" _
    And Cells(1, i) <> "LSPD" _
    And Cells(1, i) <> "ADPTH" _
    And Cells(1, i) <> "TEMP" _
    And Cells(1, i) <> "FLOWA3" _
    And Cells(1, i) <> "FLOWB3" _
    And Cells(1, i) <> "FLOWC3" _
    And Cells(1, i) <> "FLOWA2" _
    And Cells(1, i) <> "FLOWB2" _
    And Cells(1, i) <> "FLOWC2" _
    Then Columns(i).Delete
    Next i
    '
    ' End Sub

    I was hoping to add a worksheet to the workbook (here named INFO) in which I can change column names and function variables that are then read by the macro. As an example in the INFO sheet I might change the name of the last column I wish to keep by entering its name in A11. The following reference in the macro does not work as intended.


    '
    ' This section deletes columns not needed from raw data
    ' Add/change mnemonics below to specify channels to be saved
    '
    Sheets("QCData").Select
    Dim i As Long
    For i = Cells(1, Columns.Count).End(xlToLeft).Column To 1 Step -1
    If Cells(1, i) <> "CutOff" _
    And Cells(1, i) <> "TIME" _
    And Cells(1, i) <> "LSPD" _
    And Cells(1, i) <> "ADPTH" _
    And Cells(1, i) <> "TEMP" _
    And Cells(1, i) <> "FLOWA3" _
    And Cells(1, i) <> "FLOWB3" _
    And Cells(1, i) <> "FLOWC3" _
    And Cells(1, i) <> "FLOWA2" _
    And Cells(1, i) <> "FLOWB2" _
    And Cells(1, i) <> "=INFO!$A$11" _
    Then Columns(i).Delete
    Next i
    '
    ' End Sub
    Last edited by jsp_1951; 10-16-2013 at 11:14 AM.

+ 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. Replies: 0
    Last Post: 06-01-2013, 05:04 AM
  2. [SOLVED] copy active sheet, create new workbook, name new workbook based on cell reference
    By jm0392 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-20-2012, 07:12 PM
  3. Replies: 2
    Last Post: 05-01-2009, 07:06 PM
  4. use a string to reference a sheet
    By AustinBrister in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-27-2008, 02:00 PM
  5. Replies: 1
    Last Post: 02-03-2006, 12:00 PM

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