Results 1 to 4 of 4
  1. #1
    pushpm is offline Novice
    Windows 8 Access 2007
    Join Date
    Jan 2009
    Posts
    9

    Adding Variable to column

    Sub Range_End_Method()


    'Finds the last non-blank cell in a single row or column


    Dim lRow As Long
    Dim lCol As Long

    'Find the last non-blank cell in column A(1)
    lRow = Cells(Rows.Count, 1).End(xlUp).Row

    'Find the last non-blank cell in row 1
    ' lCol = Cells(1, Columns.Count).End(xlToLeft).Column

    ' MsgBox "Last Row: " & lRow & vbNewLine
    ' & _


    ' "Last Column: " & lCol


    Range("A2:AF&icol").Select
    Selection.Copy
    Sheets("Upload Dollars and Hours (2)").Select
    Range("J4").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    ActiveWindow.SmallScroll ToRight:=15

    End Sub

  2. #2
    pushpm is offline Novice
    Windows 8 Access 2007
    Join Date
    Jan 2009
    Posts
    9
    Range("A2:AF&irow").Select
    I need help on understanding how to add my Variable to column AF

  3. #3
    pushpm is offline Novice
    Windows 8 Access 2007
    Join Date
    Jan 2009
    Posts
    9
    Sub Range_End_Method()
    'Finds the last non-blank cell in a single row or column


    Dim LastRow As Long

    'Find the last non-blank cell in column A(1)
    LastRow = Cells(Rows.Count, 1).End(xlUp).Row

    MsgBox "Last Row: " & LastRow & vbNewLine


    Range("A2:AF" & LastRow).Select

    End Sub

    I get message that my last non blank row is 46900 but it does not give me selection of A2::A46900. Instead i get error # 400

    Please help me.

  4. #4
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,372

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Adding a Cell Range to a String Variable
    By RunTime91 in forum Access
    Replies: 3
    Last Post: 01-27-2018, 02:38 PM
  2. Replies: 5
    Last Post: 11-01-2013, 09:34 AM
  3. Variable Column Headings
    By asparks16 in forum Queries
    Replies: 1
    Last Post: 06-28-2012, 07:58 PM
  4. Replies: 3
    Last Post: 09-28-2011, 04:29 PM
  5. Set column name with variable
    By jgelpi16 in forum Programming
    Replies: 5
    Last Post: 01-28-2011, 12:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums