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

Exporting Access Query to Excel Brings Over Primary Key, Not Information
Else condition always happening
VBA macro not working when sent to some but not all people
Move the csv file(s) from the active folder to the sub-folder “archive”
Replacing colors in excel workbook with VBA
Anyone know how to get macro (Excel VBA) to stop when there is no next button
Update a range if the source cell is not blank, otherwise skip to next
Excel VBA - Complex code issue
Delete slicers connected to seperate source data in same workbook
Excel select rows with missing data and copy the selected rows
Excel Add-in Row Index and Values are returned as undefined
Running an Excel Add-in function using VBA on remote desktop
vba loop to add to string- Current code overwrites instead of adding to cell
Drop-down values missing when using Range formula
Best API to read/write EXCEL documents with spring mvc
How to use FpSread.SaveExcel to save multiple grid data into multiple sheets of same excel file

Categories

HOME
.htaccess
linux-kernel
logic
raster
autodesk-forge
wildfly
web-crawler
sharppcap
boost
speech-recognition
wlan
axis2
raspberry-pi3
treeset
restcomm
prefix
prestashop-1.6
drupal-modules
subplot
laravel-blade
integer
google-nativeclient
ssrs-2016
cut
apl
oracle-data-integrator
navigation-drawer
ddos
footable
wijmo5
inversifyjs
servicestack.redis
drools-fusion
lsmeans
hashcode
umbraco-mvc
responsive-filemanager
devexpress-wpf
uievent
gulp-usemin
sqlitestudio
tivoli-identity-manager
inputstreamreader
mypy
monocle-scala
knockout-validation
jake
hashset
git-stash
raptor
mds
markov-models
kmip
tizen-sdb
groovy-eclipse
orchardcms-1.9
into-outfile
oracle-streams
f#-interactive
dfdl
ng-template
rebase
wx
spatialite
aloha-editor
fswatch
html5-validation
kirby
wunderlist
review
fad
sqloledb
httpwatch
bitmapimage
mashup
factoring
parallel.for
node-http-proxy
rounded-corners
fold
stackmob
circular-reference
firepad
hiding
remotipart
vp8
converters
visual-studio-test-runner
springmockito
ctime
ext-direct
wymeditor
mobile-phones
windows-live-writer
tomahawk
blat
comdlg32
o3d

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile