+ Reply to Thread
Results 1 to 5 of 5

Paste the values

Hybrid View

  1. #1
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Paste the values

    Hi, krishnakuma6,

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE] [/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  2. #2
    Registered User
    Join Date
    08-30-2012
    Location
    UAE
    MS-Off Ver
    Excel 2016,office 365
    Posts
    69

    Re: Paste the values

    Apologies my mistake, Now I corrected.kindly please someone amend my code

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Paste the values

    Hi, krishnakuma6,

    without seeing the original and the wanted outcome maybe check
    Sub Test()
    Dim lngN As Long
    Dim lngM As Long
    Dim ws1 As Worksheet
    Dim wsM As Worksheet
    
    Set ws1 = Sheets("Sheet1")
    Set wsM = Sheets("Manpower")
    
    With wsM
      ws1.Cells.ClearContents
      ws1.Cells(2, 1).Resize(1, 16).Value = .Range(.Cells(2, 2), .Cells(2, 17)).Value
      ws1.Cells(2, 15) = "Contract code"
      ws1.Cells(2, 16) = "Percentage"
      
      For lngN = 3 To .Cells(Rows.Count, 1).End(xlUp).Row
        If .Cells(lngN, 1).Value = "" Then Exit For
        For lngM = 17 To .Cells(3, Columns.Count).End(xlToLeft).Column
          If .Cells(lngN, lngM) <> "" Then
            ws1.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Resize(1, 14).Value = .Range(.Cells(lngN, 2), .Cells(lngN, 15)).Value
            ws1.Cells(Rows.Count, 1).End(xlUp).Offset(0, 14) = .Cells(2, lngM)
            ws1.Cells(Rows.Count, 1).End(xlUp).Offset(0, 15) = .Cells(lngN, lngM)
          End If
        Next lngM
      Next lngN
    End With
    
    Set wsM = Nothing
    Set ws1 = nopthing
    
    End Sub
    Ciao,
    Holger

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 3
    Last Post: 11-29-2014, 01:14 PM
  2. copy formula and paste for new data added and autofill.....and paste special values
    By prabhuduraraj09 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-13-2014, 07:40 AM
  3. Replies: 1
    Last Post: 12-05-2012, 11:37 AM
  4. [SOLVED] Excel 2002 - Can only paste values, wont let me paste special
    By MK_Chopper_P in forum Excel General
    Replies: 2
    Last Post: 07-12-2012, 02:22 AM
  5. Replies: 2
    Last Post: 04-12-2011, 09:46 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