Results 1 to 6 of 6

Copy range to other sheet depending on entry in cell

Threaded View

  1. #1
    Registered User
    Join Date
    03-17-2016
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    3

    Copy range to other sheet depending on entry in cell

    Hello,

    I recently discovered VBA.
    I want to write values froms cells C4:C10 to another sheet, depending on the number given in C2.
    On the next worksheet (ws2), I have number 1 to 10. If the number in the first row is the same as given in C2, then the values (C4:10) need to be copied in the cells below that number.

    I already got a code to find the the same number:
    Private Sub CommandButton1_Click()
    Dim FindString As String
    Dim Rng As Range
    FindString = Sheets("ws1").Range("c2").Value
    If Trim(FindString) <> "" Then
    With Sheets("ws2").Range("B1:K1")
    Set Rng = .Find(What:=FindString, _
    After:=.Cells(.Cells.Count), _
    LookIn:=xlValues, _
    LookAt:=xlWhole, _
    SearchOrder:=xlByRows, _
    SearchDirection:=xlNext, _
    MatchCase:=False)
    If Not Rng Is Nothing Then
    Application.Goto Rng, True
    Else
    MsgBox "Nothing found"
    End If
    End With
    End If
    End Sub
    Many thanks! *How can I add an attachment to this post?
    screenshot excel test.png screenshot excel test2.png Test.xlsm
    Last edited by RutgerdV; 03-17-2016 at 05:49 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Check cell value in range, depending on condition copy to another Sheet
    By KemalO in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-28-2015, 11:01 AM
  2. Replies: 0
    Last Post: 03-24-2014, 07:31 AM
  3. [SOLVED] Copy & paste entire row to different sheet based on cell entry
    By XxCMoneyxX in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-14-2013, 07:52 PM
  4. [SOLVED] Copy cell from 1 sheet to another sheet depending on what info is displayed in a cell
    By chilli76 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-24-2013, 12:33 PM
  5. Macro to copy data from one sheet to another depending on name in first cell
    By subtilty in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-14-2013, 07:44 AM
  6. [SOLVED] IF forumla - need to populate a cell on one sheet depending on range of cells in another
    By Emma2902 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 12-14-2012, 07:43 AM
  7. Copy a range to different sheets depending on first cell contents
    By WaveOfMutilation in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 03-01-2010, 12:58 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1