Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 03-03-2015, 02:56 PM
excelledsoftware excelledsoftware is offline For Next Loop cell values Windows 7 64bit For Next Loop cell values Office 2003
IT Specialist
 
Join Date: Jan 2012
Location: Utah
Posts: 455
excelledsoftware will become famous soon enough
Default

Pretty easy to do actually. Make sure to dim your other worksheets and give them a variable name such as ws and ws1. I will typically use ws for the worksheet that has the data and then rws for the worksheet that gets the results. When you set something you are telling Excel that you want to reference an object. This is different than setting a string = "Your Name Here" which you would do like so.
Code:
TestString = "Your Name Here"
To set a worksheet that is named Data and another worksheet that is named Results refer to the following example.
Code:
  Dim ws as Worksheet, rws as Worksheet

  Set ws = ThisWorkbook.Worksheets("Data")
  Set rws = ThisWorkbook.Worksheets("Results")
You can of course set a variable as a workbook so you dont have to type in ThisWorkbook all the time. This code below should serve as a great reference.

Code:
   Dim ws as Worksheet, rws as Worksheet, wb as Workbook

  Set wb = ThisWorkbook
  Set ws = wb.Worksheets("Data")
  Set rws = wb.Worksheets("Results")
Let me know if you have any other questions.

Thanks
Reply With Quote
 

Tags
loop, range



Similar Threads
Thread Thread Starter Forum Replies Last Post
For Next Loop cell values Convert non-cell input to cell values TBD Excel 3 06-09-2014 06:14 AM
For Next Loop cell values Sum values within a single cell shabbaranks Excel 17 05-13-2014 06:47 PM
How do you loop through an array with some empty values? omahadivision Excel Programming 5 11-28-2013 10:49 AM
change values based on cell ubns Excel 1 05-21-2012 06:28 PM
For Next Loop cell values Automatic, Dependent Cell Values flackend Excel 2 08-26-2011 07:01 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:35 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft