excel


How to copy the data in last row and copy to the last row of a table in the same worksheet automatically using excel vba?


I am trying to find way on how to select and copy the data from the last row (column F to I) to the last row of 'summary" table (column O to R). For now this is the code that i found but it seems that it can paste within the same range of column with different row. For example, it will copy data F38:I38 and paste the data at F40:I40. However, what i want is to copy data F38:I38 and the code will find the last row of 'summary'table and paste data F38:I38 to the last empty row. Is it possible to find two last row of the same worksheet but different number of cell? Is there any way i can automate this process?
Dim lastRowI As Integer
lastRowI = ws.Cells(Rows.Count, 6).End(xlUp).Row
ws.Activate
ws.Range(Cells(lastRowI, 6), Cells(lastRowI, 9)).Select
Selection.Copy
ws.Range(Cells(lastRowI + 2, 6), Cells(lastRowI + 2, 9)).Select
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Assuming that you have named your table "Summary",
The following code will take you to the last row of "Summary" table
ActiveSheet.Range("Summary").Select
Selection.End(xlDown).Select

Related Links

“Cannot insert object” Error when inserting PDF files/objects into Microsoft Excel
Referencing the selection in deactivated Workbook
Excel - Export cells identified by countif to new file
Attempting to search for strings and having syntax errors
Excel Error 1004 when referencing ranges with VBA
Multiple uses of SaveAs freeze Excel
XYScatter Plot Incorrect XAxis when Drawn in Visual Basic?
Why is “if isna vlookup” quicker than “countif”?
PrintLoop mass print all rows of data in file
Look for which cell in a row has a numberic value and return that value to another cell
Check if a matrix is symmetric in Excel and LibreOffice
How to use column letters in VBA
Create a countIfs function that ignores cells with text that has been struck through
Adding and counting values from unique entries
How do I compare two columns in different sheets for non existing values and then copy them to the main sheet?
Is There a Way to Pull Individual Rows from Multiple Sheet Excel

Categories

HOME
node.js
solr
sql-server-2005
javafx-2
google-cloud-kms
contiki
datagrid
bluetooth-lowenergy
servo
slim
interaction
docbook
amazon-route53
ietf-netmod-yang
border
markup
ajaxform
deprecation-warning
gembox-document
github-api
avaya
messagebox
jquery-ui-autocomplete
cad
kinvey
sublimerepl
cloudfoundry-uaa
asn.1
polymer-serve
psftp
dexguard
pymodbus3
kernel-module
james
nsubstitute
xfs
lift
oracle-ebs
ektron
media-type
imei
trace
autocorrect
zlib
showdown
webrole
sift
angularjs-service
vqmod
cscope
playstation
google-api-v3
code-collaborator
post-commit
deferred-loading
smf
qtquick2
website-deployment
oracle-streams
mongoose-web-server
opcode
tess-two
fileapi
excel-2008
window-position
fluid-layout
cordova-chrome-app
safari9
google-client
rich-snippets
iec61131-3
appcompat-v7-r22.1
aglio
xcode-instruments
runscope
cxf-client
rhodecode
apiaxle
sencha-touch-2.2
dbase
c++builder-6
rs485
websitespark
apprequests
eclipse-wtp
jwebunit
java-service-wrapper
badimageformatexception
jax-rpc
pubchem
xemacs
in-app
web-setup-project
rebuild
open-flash-chart
installshield-2008
xla
platform-independence
pvcs
remote-administration

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App