Not sure how much help you're looking for.
You said that you "don't know the VB language".
Does that mean that you don't know how to use the VB editor?
do you know how to write a macro?
Can you create your command button and assign a macro?
What version of Excel are you using?  It won't matter for the VB, but it
will help in deciding how to describe it to you.

Another "technique":
You describe activating a sheet, copying a range, activating another sheet and 
pasting the data.
That is actually CPU intensive and causes a lot of screen flicker.
I prefer to copy the data from one sheet to another without selecting them.

I wrote this quick macro:

Option Explicit
Sub Btn_Copy()
    Dim FirstRow, LastRow, DestRow, R
    Dim FirstCol, LastCol, DestCol, C
    Select Case Sheets("Sheet3").Range("C39").Value
        Case 4
            FirstRow = 1
            LastRow = 7
            FirstCol = 1
            LastCol = 13
        Case 5
            FirstRow = 9
            LastRow = 15
            FirstCol = 1
            LastCol = 14
        Case 6
            FirstRow = 17
            LastRow = 23
            FirstCol = 0
            LastCol = 0
        Case 7
            FirstRow = 25
            LastRow = 31
            FirstCol = 0
            LastCol = 0
        Case 8
            FirstRow = 33
            LastRow = 39
            FirstCol = 0
            LastCol = 0
        Case Else
            FirstRow = 0
            LastRow = 0
            FirstCol = 0
            LastCol = 0
    End Select
    If (FirstRow > 0) Then
        DestRow = 7 - 1  ' (7) represents the first row in the destination, 
(-1) prepares it for incrementing in the loop
        For R = FirstRow To LastRow
            DestRow = DestRow + 1
            DestCol = 1 - 1
            For C = FirstCol To LastCol
                DestCol = DestCol + 1
                Sheets("Sheet2").Cells(DestRow, DestCol) = 
Sheets("Sheet3").Cells(R, C)
            Next C
        Next R
    End If
End Sub

If I KNEW that you were always going to copy 7 rows, then I could calculate it 
mathematically.
But your columns were different for C39=4 (M) and C39=5 (N).  
Therefore, I concluded that the rows/columns weren't consistent.

If you need more help with putting the VBA code into a module and assigning it 
to a button,
then we've got a lot more work to do!

hth,

Paul


----- Original Message ----
> From: Thunderwhelmed <april.hil...@gmail.com>
> To: MS EXCEL AND VBA MACROS <excel-macros@googlegroups.com>
> Sent: Tuesday, January 13, 2009 7:30:14 PM
> Subject: $$Excel-Macros$$ IF-THEN macro
> 
> 
> Hi all,
> 
> I have a worksheet that contains a column of 8 dropdown lists (combo-
> boxes) from a range in a different sheet. I have the (numerical)
> results of each selection set up to display in a hidden column. In
> another cell, I used the COUNTIF function to count the results of all
> selections >0 (0=no selection).
> 
> What I need to do is, based on that count, use a command button to
> activate another sheet in the same workbook, select a range of cells,
> then copy + paste into yet another sheet.
> 
> Basically:
> 
> if Cell C39=4, then
> Activate Sheet3
> Select range A1:M7
> Copy range
> Activate Sheet2
> Paste range into Sheet2, starting at cell A7.
> 
> --OR--
> 
> if Cell C39=5, then
> Activate Sheet3
> Select range A9:N15
> Copy range
> Activate Sheet2
> Paste range into Sheet2, starting at cell A7.
> 
> etc, etc, when C39 = 6, 7, or 8
> 
> I know it's all pretty much there, but I don't know the VB language.
> 
> I would really appreciate some help!  Thank you in advance!
> 
> April
> 
> PS, does anyone know how to lock the contents of an entire sheet once
> that command button has been pressed? thanks!
> 
> 

--~--~---------~--~----~------------~-------~--~----~
Visit the blog to download Excel tutorials at 
http://www.excel-macros.blogspot.com

To post to this group, send email to excel-macros@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/excel-macros?hl=en

Visit & Join Our Orkut Community at 
http://www.orkut.com/Community.aspx?cmm=22913620

To Learn VBA Macros Please visit http://www.vbamacros.blogspot.com

To see the Daily Excel Tips, Go to:
http://exceldailytip.blogspot.com
 
If you find any spam message in the group, please send an email to Ayush @ 
jainayus...@gmail.com
-~----------~----~----~----~------~----~------~--~---

Reply via email to