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

Conditional AGGREGATE/Median in Excel 2010
Excel VBA filtering a column and then copying each item in the area collection to a matching row
Excel addition of multiple numbers in single cell
How do I autofill code in VBA?
Use excel VBA to update master list based on user input data
Change number format of a cell which inlude currecny using visual basic
Access reading Excel VBA date in US format
Changing a file name and path in a formula (within a macro) to user-defined
Excel conditional formating - conditional on sum of all previous cells and total sum
Consolidating single rows of data from multiple sheets into one - looping the macro?
Excel FInd and Replace Regex Macro
Excel VBA Loop function for all cells
Excel/VBA uncheck checkboxes if madatory field is empty
Excel VBA continually returning 0
Excel VBA: unable to disable DisplayAlert during drag+drop?
How to deal with Cyrillic letters caused error (#REF) in Worksheets (Unicode VBA display and handling), in VBA

Categories

HOME
.htaccess
coldfusion
solr
rstudio
gradle
angular-material2
modularity
zurb-foundation
maven-lifecycle
uwp-xaml
ibm-mobilefirst
bootstrap-datepicker
servicestack
visual-studio-mac
mariadb
wayland
facebook-live-api
cordova-plugins
crc
netfilter
jasperserver
ccache
ninja
restcomm
spring-aop
benchmarking
unity3d-unet
prefix
spring-statemachine
nlog
stackdriver
cider
unimrcp
xmlstarlet
indexoutofrangeexception
scons
akka-stream
ireport
induction
opensaml
nestedscrollview
filestream
nerdtree
android-auto
model-driven
marytts
uievent
android-device-monitor
google-truth
modelio
http-status-code-415
dwt
run-configuration
silent-installer
cakephp-3.3
sp-executesql
android-7.1-nougat
cpio
google-chartwrapper
nokia
nibble
servant
highcharts-ng
rgraph
execution-time
pdl
zshrc
wordpress-4.5
excel-2008
determinants
jxa
ironscheme
opencv-features2d
linux-capabilities
swift-protocols
resharper-plugins
jsqlparser
kiwi
zurb-joyride
ios-provisioning
controltemplate
opendocument
chaplinjs
avassetwriter
resharper-7.1
system.speech.recognition
imagecreatefrompng
dotfuscator
memory-mapped-files
alpha-five
html-validation
32feet
actinic
iphone-sdk-3.0
hibernate-annotations
google-doodle
looper
iasyncresult
vtl
blat
incremental-linking
orbited
vmwaretasks
pdc2008

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