Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Mr. Smiley
 
Posts: n/a
Default Very very basic macro help

I am trying to learn visual basic through example. Can somone help me solve
this problem?

I have two different Excel workbooks, both located on my desktop.

The first is named Book1.xls The second is Book2.xls

On Sheet 1 of Book1, under column A (cells 2 through 11) I have the numbers
1 through 10.

I would like to write a macro that copies the values in these cells and
pastes them into sheet 1 of Book2, in the same cells. Also, I would like for
the cells in book 2 to be red, and the font to be bold and white.

Please help. Thanks.


  #2   Report Post  
Tushar Mehta
 
Posts: n/a
Default

In XL turn on the macro recorder (Tools | Macro Record new macro...),
use the UI to do whatever it is you want to do, and turn off the
recorder. XL will give you the necessary code. You can then
streamline/customize it. See
Beyond Excel's recorder
http://www.tushar-
mehta.com/excel/vba/beyond_the_macro_recorder/index.htm


--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
I am trying to learn visual basic through example. Can somone help me solve
this problem?

I have two different Excel workbooks, both located on my desktop.

The first is named Book1.xls The second is Book2.xls

On Sheet 1 of Book1, under column A (cells 2 through 11) I have the numbers
1 through 10.

I would like to write a macro that copies the values in these cells and
pastes them into sheet 1 of Book2, in the same cells. Also, I would like for
the cells in book 2 to be red, and the font to be bold and white.

Please help. Thanks.



  #3   Report Post  
David Hepner
 
Posts: n/a
Default

This code was produced by the macro recorder (it's a good way to learn how to
write macros):

Sub Macro1()
Windows("Book1").Activate
Range("A2:A11").Select
Selection.Copy
Windows("Book2").Activate
Range("A2").Select
ActiveSheet.Paste
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
End With
Selection.Font.ColorIndex = 2
Selection.Font.Bold = True
Range("A12").Select
End Sub


"Mr. Smiley" wrote:

I am trying to learn visual basic through example. Can somone help me solve
this problem?

I have two different Excel workbooks, both located on my desktop.

The first is named Book1.xls The second is Book2.xls

On Sheet 1 of Book1, under column A (cells 2 through 11) I have the numbers
1 through 10.

I would like to write a macro that copies the values in these cells and
pastes them into sheet 1 of Book2, in the same cells. Also, I would like for
the cells in book 2 to be red, and the font to be bold and white.

Please help. Thanks.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro Calling Visual Basic References phauenstein Excel Discussion (Misc queries) 1 August 24th 05 09:28 PM
Help with macro looping and color query function kevinm Excel Discussion (Misc queries) 10 May 26th 05 01:25 AM
How do I run a Macro on basic of a value in a specific cell Steen H. Pedersen Excel Worksheet Functions 3 April 16th 05 08:52 AM
Date macro Hiking Excel Discussion (Misc queries) 9 February 3rd 05 12:40 AM
Visual Basic Macro negzel Excel Discussion (Misc queries) 1 December 28th 04 10:53 PM


All times are GMT +1. The time now is 08:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"