+ Reply to Thread
Results 1 to 4 of 4

using range with offset in vba

  1. #1
    Registered User
    Join Date
    05-23-2014
    Posts
    12

    using range with offset in vba

    on the code below, I'm having trouble setting up the range.
    B1 will be a variable later, but I'm getting error where it says ":"
    What is the proper way of writing this?

    Worksheets("Sheet2").Range(Range("B1").Offset(0,4):Range("B1").Offset(0,16)).Select

    Thank you

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: using range with offset in vba

    There are several ways it could be done. Here are two.

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: using range with offset in vba

    Hi, gameybeets,

    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  4. #4
    Registered User
    Join Date
    05-23-2014
    Posts
    12

    Re: using range with offset in vba

    Thank you!!!
    Works good
    Last edited by gameybeets; 05-23-2014 at 12:34 PM.

+ 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] Problemas with object assignation in hierachy Range.Offset.Range
    By rensalzado in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-19-2014, 02:39 AM
  2. [SOLVED] Define new range names based on existing range name offset 1 column to right
    By jprlimey in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-03-2014, 07:53 PM
  3. Replies: 1
    Last Post: 01-23-2013, 03:00 PM
  4. Dynamic Range using Offset, range not found for Pivot
    By GoneBaja in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-08-2012, 09:19 AM
  5. Replies: 2
    Last Post: 08-22-2005, 01:05 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