Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default One button, Multi Cells

I'm somewhat new to VBA and I sure could use some help. I'm trying to put a
command button in Excel (2003) on sheet1 that when clicked will select 4
certain cells (a3, b5, c8 and b11) and paste them onto the next blank row on
sheet2 in that order. Can this be done without setting up 4 different
buttons? Any help anyone could give would be so appreciated. Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default One button, Multi Cells

Can you be a bit more specific on where you want to paste them on Sheet2?
What column/s do you want them in? You have specified cells a3, b5, c8 and
b11 to copy. 2 of these are in column B so I am assuming you don't want them
in the corresponding columns on Sheet2. Perhaps you want them one under the
other in the same column; but which column?

--
Regards,

OssieMac


"Axanamoon" wrote:

I'm somewhat new to VBA and I sure could use some help. I'm trying to put a
command button in Excel (2003) on sheet1 that when clicked will select 4
certain cells (a3, b5, c8 and b11) and paste them onto the next blank row on
sheet2 in that order. Can this be done without setting up 4 different
buttons? Any help anyone could give would be so appreciated. Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default One button, Multi Cells

What I need is for those particular cells go into the next blank ROW on
sheet2 filling in columns a b c d left to right. My boss wants me to keep a
log of voids and since my void form is in excel I thought it would be easier
if I could get a button that would automatically take the information from
cells a3 b5, c8 and b11 and put it the log rather than me having to copy and
paste. I can get it to do this one by one but I was hoping to get a single
click to do it. Do you think it can be done?

"OssieMac" wrote:

Can you be a bit more specific on where you want to paste them on Sheet2?
What column/s do you want them in? You have specified cells a3, b5, c8 and
b11 to copy. 2 of these are in column B so I am assuming you don't want them
in the corresponding columns on Sheet2. Perhaps you want them one under the
other in the same column; but which column?

--
Regards,

OssieMac


"Axanamoon" wrote:

I'm somewhat new to VBA and I sure could use some help. I'm trying to put a
command button in Excel (2003) on sheet1 that when clicked will select 4
certain cells (a3, b5, c8 and b11) and paste them onto the next blank row on
sheet2 in that order. Can this be done without setting up 4 different
buttons? Any help anyone could give would be so appreciated. Thanks.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default One button, Multi Cells

If you have column headers on the destination sheet the data will be copied
on to the next row each time you run the code. If no column headers then a
blank row will be left at the top of the sheet but after that the data will
all be on the next available row.

Note that a space and underscore at the end of a line is a line break in an
otherwise single line of code.

Private Sub CommandButton1_Click()
Dim rngDest As Range

'Edit "Sheet2" to your destination sheet name
With Sheets("Sheet2")
Set rngDest = .Cells(.Rows.Count, "A") _
.End(xlUp).Offset(1, 0)
End With

With ActiveSheet
.Range("A3").Copy _
Destination:=rngDest

.Range("B5").Copy _
Destination:=rngDest.Offset(0, 1)

.Range("C8").Copy _
Destination:=rngDest.Offset(0, 2)

.Range("B11").Copy _
Destination:=rngDest.Offset(0, 3)
End With
End Sub

--
Regards,

OssieMac


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
multi cells selected greg Excel Programming 3 February 28th 08 10:58 PM
multi line cells Joanne[_4_] Excel Programming 7 July 19th 06 04:06 AM
multi line caption on command button?? neowok[_87_] Excel Programming 3 February 16th 06 09:50 AM
multi function cells kellerfro Excel Discussion (Misc queries) 4 June 27th 05 07:34 PM
Multi Select Cells David Excel Programming 2 February 15th 05 06:35 PM


All times are GMT +1. The time now is 10:29 PM.

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

About Us

"It's about Microsoft Excel"