Copying Values from ranges to tables

anbhavane

New Member
Joined
Jul 12, 2021
Messages
20
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
  3. Mobile
  4. Web
I have created a table and want to copy the values from range to table cells(row), but the values are getting copied to cells(rows below table). request you to kindly help..
I am using following code.

ThisWorkbook.Worksheets("Data").Range("AC" & Rows.Count).End(xlUp).Offset(1).Resize(, 324).Value = ThisWorkbook.Worksheets("Data").Range("AC3:MN3").Value

Table contains range AC5:MN5 where I want the copied values to get stored. Table ends at AC130:MN130. All the columns and rows are empty. The value gets stored in row below end of table. range AC131:MN131.

Thanks.
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Try:
VBA Code:
Sub test()
    Dim LastRow As Long
    LastRow = Sheets("Data").Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Sheets("Data").Range("AC" & LastRow + 1).Resize(, 324).Value = Sheets("Data").Range("AC3:MN3").Value
End Sub
 
Upvote 0
Try:
VBA Code:
Sub test()
    Dim LastRow As Long
    LastRow = Sheets("Data").Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Sheets("Data").Range("AC" & LastRow + 1).Resize(, 324).Value = Sheets("Data").Range("AC3:MN3").Value
End Sub
Not working.. it copies values to 145th row ie. 15 rows down..
 
Upvote 0
Do you have any formulae or data validation lists in your sheet?
 
Upvote 0
I have created a table and want to copy the values from range to table cells(row), but the values are getting copied to cells(rows below table). request you to kindly help..
I am using following code.

ThisWorkbook.Worksheets("Data").Range("AC" & Rows.Count).End(xlUp).Offset(1).Resize(, 324).Value = ThisWorkbook.Worksheets("Data").Range("AC3:MN3").Value

Table contains range AC5:MN5 where I want the copied values to get stored. Table ends at AC130:MN130. All the columns and rows are empty. The value gets stored in row below end of table. range AC131:MN131.

Thanks.
This works well when the table is converted to range.
 
Upvote 0
Glad it worked out. :)
Your shared code didnt work the way I wanted.. The code I was using was working earlier without converting range to table. The code I was using is not copying values if I convert range to table.
 
Upvote 0
It would be easier to help if you could use the XL2BB add-in (icon in the menu) to attach a screenshot (not a picture) of your sheet. Alternately, you could upload a copy of your file to a free site such as www.box.com or www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. Explain in detail what you want to do referring to specific cells, rows, columns and sheets using a few examples from your data (de-sensitized if necessary).
 
Upvote 0

Forum statistics

Threads
1,215,043
Messages
6,122,816
Members
449,095
Latest member
m_smith_solihull

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top