View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Edward Edward is offline
external usenet poster
 
Posts: 34
Default VBA code to move contents from one cell to another


Trina wrote:
I want to create a page in Excel (lets call it page 1) where I can enter a
Job Name, and once entered, click a button and have that Job Name move to the
next available space on a master Job List, located on another page (page 2).
At the same time I want the Job Name entered on page 1 to disappear, so I can
enter another Job name and repeat the process. I have not used VBA before,
but it sounds like this may be possible through code. Any help would be
appreciated. Thanks.


This is a pretty basic problem with many, many ways to implement. I
will detail one way.

After you put your button on page 1, assign the click event to it and
put in code something like:

x = Sheets("page 1").Cells(1, 1).Value
Sheets("page 2").Cells(1, 2) = Sheets("page 2").Cells(1, 2) + 1
rowNum = Sheets("page 2").Cells(1, 2).Value
Sheets("page 2").Cells(rowNum, 1) = x
Sheets("page 1").Cells(1, 1) = ""

Where on "page 2" cell B1 (Sheets("page 2").Cells(1, 2)) will store the
current record count of your jobs and on "page 1" cell A1 (Sheets("page
1").Cells(1, 1)) is where you will store your data.