• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

VBA SCRIPT TO OFFSET SELECTED RANGE|VBA & Macros|Excel Forum|My Online Training Hub

You are here: Home / VBA SCRIPT TO OFFSET SELECTED RANGE|VBA & Macros|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search|Last Search Results
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumVBA & MacrosVBA SCRIPT TO OFFSET SELECTED RANGE
sp_PrintTopic sp_TopicIcon
VBA SCRIPT TO OFFSET SELECTED RANGE
Avatar
Themba Motha
Member
Members
Level 0
Forum Posts: 8
Member Since:
December 4, 2018
sp_UserOfflineSmall Offline
1
January 17, 2019 - 10:47 pm
sp_Permalink sp_Print

Hey Team,

Is there a way to OffSet a selection range of cells to a different location. I need a script that is dymanic for example:

Offset:

Selected Cells range A1:A5 to C1:C5 or B1:B10 to E1:E10 using the same script, which should be based on selected ranges.

 

Script being used to select range is as below:

'Range("A1").Select
'Range(Selection, Selection.End(xlDown)).Select

 

Rgds,

Themba.

Avatar
Velouria
London or thereabouts
Moderator
Members


Trusted Members

Moderators
Level 4
Forum Posts: 622
Member Since:
November 1, 2018
sp_UserOfflineSmall Offline
2
January 17, 2019 - 11:53 pm
sp_Permalink sp_Print

Those are different offsets - how should the code determine what offset you want?

Avatar
Themba Motha
Member
Members
Level 0
Forum Posts: 8
Member Since:
December 4, 2018
sp_UserOfflineSmall Offline
3
January 18, 2019 - 5:40 pm
sp_Permalink sp_Print

The script should be based on the selected cells.

Avatar
Velouria
London or thereabouts
Moderator
Members


Trusted Members

Moderators
Level 4
Forum Posts: 622
Member Since:
November 1, 2018
sp_UserOfflineSmall Offline
4
January 19, 2019 - 7:00 pm
sp_Permalink sp_Print

I mean how does it know how far to offset from the selection?

Avatar
Themba Motha
Member
Members
Level 0
Forum Posts: 8
Member Since:
December 4, 2018
sp_UserOfflineSmall Offline
5
January 21, 2019 - 6:29 am
sp_Permalink sp_Print

I guess there is no way...thanks will find a work around

Avatar
Velouria
London or thereabouts
Moderator
Members


Trusted Members

Moderators
Level 4
Forum Posts: 622
Member Since:
November 1, 2018
sp_UserOfflineSmall Offline
6
January 23, 2019 - 3:16 am
sp_Permalink sp_Print

There are plenty of ways but you haven't explained what you want. Do you want a prompt to specify how many columns across to offset? Or should it actually be a fixed number in spite of your examples?

Avatar
Philip Treacy
Admin
Level 10
Forum Posts: 1517
Member Since:
October 5, 2010
sp_UserOfflineSmall Offline
7
January 23, 2019 - 12:48 pm
sp_Permalink sp_Print

Hi Themba

as Velouria said, you haven’t explained what you are trying to do or why you are doing it. If we don’t understand the problem and the result you expect it’s difficult to provide help. 

Regards

Phil

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: RAQUEL ACION, Dana Friedt, Shawn Barwick, Nada Perovic
Guest(s) 11
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 870
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 219
A.Maurizio: 202
Jessica Stewart: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
terimeri dooriyan
Jack Aston
AndyC
Denise Lloyd
michael serna
mashal sana
Tiffany Kang
Leah Gillmore
Sopi Yuniarti
LAFONSO HERNANDEZ
Forum Stats:
Groups: 3
Forums: 24
Topics: 6218
Posts: 27266

 

Member Stats:
Guest Posters: 49
Members: 31901
Moderators: 3
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.