+ Reply to Thread
Results 1 to 2 of 2

Finding last blank column for a specific row using row no and pasting the data

  1. #1
    Registered User
    Join Date
    10-10-2020
    Location
    India
    MS-Off Ver
    2010
    Posts
    1

    Finding last blank column for a specific row using row no and pasting the data

    Hi,
    I have two different files say 'File_A' & 'File_B'. I have copied the data from 'File_A', now I want to paste it in 'File_B'
    The thing is my 'File_B' in in the format as attached. How do I paste it in the last blank column for a particular row..(say 102 row no)

    Below is my code..but my data gets pasted in the previous column everytime I run it..say first time it gets pasted in column D, then in column C like that.

    Please suggest the changes in my code.

    Sub Test()

    Workbooks.Open "C:\Data\File_B"
    Worksheets("Sheet9").Activate
    Worksheets("Sheet9").Select

    Range("B" & Rows.Count).End(xlUp).Select
    Range(Selection, Selection.End(xlToRight)).Select

    Selection.Copy
    Workbooks("File_B").Sheets("A1").Activate
    Dim last_col As Integer

    last_col = Cells(102, Columns.Count).End(xlToLeft).Select


    Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
    False, Transpose:=True
    Application.CutCopyMode = False
    ActiveWorkbook.Save

    End Sub
    Attached Files Attached Files
    Last edited by pauly980; 10-10-2020 at 03:26 PM.

  2. #2
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Finding last blank column for a specific row using row no and pasting the data

    You need to paste the data into a specific cell, not just a column value. See Red text below.

    Please Login or Register  to view this content.

+ 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. Finding last non blank data of a column for a multiple workbook
    By Jowj in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-04-2016, 01:43 AM
  2. Extracting data from column based on specific criteria and pasting into new column
    By vanvalkenburg in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-14-2012, 10:26 PM
  3. finding specific data from one table and pasting it into another table
    By saranorton in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-29-2011, 09:35 AM
  4. Finding blank cells and pasting below each blank cell
    By lilshaq in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-01-2011, 03:50 AM
  5. Finding next blank row and pasting problem
    By koklok in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-20-2008, 11:47 AM
  6. Pasting into the next blank cell in a column, rather than specific cell.
    By mackinlay in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-10-2008, 08:57 AM
  7. finding blank cell and moving specific data into it
    By BeJay in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-30-2006, 02:10 PM

Tags for this Thread

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