Results 1 to 1 of 1
  1. #1
    2 Star Lounger
    Join Date
    Jun 2011
    Posts
    188
    Thanks
    62
    Thanked 0 Times in 0 Posts

    Lightbulb code adjustement copy data from every B2 and go for last used range

    Hi CephasOz,


    CephasOz this is your code which work perfectly . just a little amendent required . when the data is copy from slave sheet always copy data from column column B2 ' if cell are empty does not matter copy data to master but go to last cell and copy. Iam attaching the work book what i need too.



    HTML Code:
    Sub FixedDataToTemplate3()
    
        Dim wksMaster As Worksheet
        Dim wksSlave As Worksheet
        Dim rngCopy As Range
        Dim lngCol As Long
        
    
          Set wksMaster = ThisWorkbook.Worksheets("Master")
        Set wksSlave = ThisWorkbook.Worksheets("Slave")
        lngCol = 2 'column
        
        Set rngCopy = Application.Intersect(wksSlave.UsedRange, wksSlave.Columns(lngCol))
        If Not rngCopy Is Nothing Then
             rngCopy.Copy Destination:=wksMaster.Range("B3")
        End If
        Set rngCopy = Nothing
        Set wksMaster = Nothing
        Set wksSlave = Nothing
       
        Application.DisplayAlerts = True
    Application.DisplayAlerts = False
    ActiveWorkbook.Save
    Application.DisplayAlerts = True
       
    
    End Sub

    IF i change this below line like that iam not sure that achieve the results


    HTML Code:
    Set rngCopy = Application.Intersect(wksSlave.UsedRange(), wksSlave.Columns(lngCol))

    Cheers
    Attached Files Attached Files
    Last edited by farrukh; 2012-02-01 at 11:31.

Posting Permissions

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