Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-07-2013, 09:45 PM
BobBridges's Avatar
BobBridges BobBridges is offline how can I cut and paste a line in page1 to page 2 by clicking a button? Windows 7 64bit how can I cut and paste a line in page1 to page 2 by clicking a button? Office 2010 32bit
Expert
 
Join Date: May 2013
Location: USA
Posts: 700
BobBridges has a spectacular aura aboutBobBridges has a spectacular aura about
Default

Ok, let's see what's next...yes, picking up the two values in A2 and A3 and pasting them into the desired sheet. Still proceeding a few steps at a time, let's do this:
Code:
Sub Something() 'I don't care what you name it.
  Set wo = ThisWorkbook
  Set soFm = wo.Worksheets("Page1")

  snTo = soFm.Range("A1").Value 'collect the data from Page1
  v2 = soFm.Range("A2").Value
  v3 = soFm.Range("A3").Value

  set soTo = wo.Worksheets(snTo) 'paste the data in the target sheet
  soTo.Range("A2").Value = v2
  soTo.Range("A3").Value = v3
  End Sub
This still isn't finished, of course, but it takes the next step. The three statements marked "collect the data" take each of the values in A1, A2 and A3 and put them in three variables. The next statement sets soTo ("sheet object To") to point to whatever worksheet is named in A1. The last two statements put the values into A2 and A3 of the target sheet.



There are still several things wrong. For one thing, you want to cut the data from Page1, but this program is only copying it. And for another, in the new worksheet it's pasting the data in column A, but you need it to find the next free column to the right and paste it there (right?). But again, let's make sure this part is working right before we go on.

Also, you should feel free to rename the variables in this program to suit your own preferences, and to add or modify the comments so that they make sense to you rather than to me. Write them in your own language, of course (what is your language, anyway?), but also have them tell you more than I've chosen to say.

Before we go on to the next step, please a) confirm that your code is pasting the correct data into the correct worksheet (though not, yet, the correct column), and b) show me what your version of this program looks like so far.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can you prevent an empty line from appearing in the first line of a page? New Daddy Word 10 11-18-2013 07:01 AM
how can I cut and paste a line in page1 to page 2 by clicking a button? Find, copy and paste into a new page jperez84 Word VBA 24 09-20-2012 11:34 AM
how can I cut and paste a line in page1 to page 2 by clicking a button? How to paste into another app without line numbers? Moonf4 Word 1 04-18-2011 03:16 PM
First line on page is truncated (top of line) OwlCat1212 Word 0 02-14-2011 03:24 PM
How to cut and paste a graphic to a different page in word.? soooty Drawing and Graphics 1 08-12-2010 11:17 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:56 AM.


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