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

Excel VBA choose cells to print - Set Print Area
Error when closing file
Sorting on key having chars and numbers
Copying data from one reference Excel workbook into another varying one
Do loop not working on findrange for user input
Synchronizing time between 2 cells in excel
Powerapps: button selection on a previous screen prefill a field in a form
Paste value based on index match
How to organise customers according to their membership level
this vba is giving me a background refresh error, how can i get rid of this debug
excel - holiday costs, sum up who paid for what
Apply dynamic AutoFilter across worksheets based on filter on 1st sheet
Conditional Formatting Error VBA
Sum of Vlookups advice
Excel custom data validation with multiple criteria
Simplify Networkdays Function, contains several IF options

Categories

HOME
google-maps-api-3
firebase-authentication
sendmail
mapkit
virtocommerce
chapel
widget
datepicker
lokijs
boost-intrusive
docbook
wmi-query
alexa-voice-service
filenet-p8
cassandra-cli
redactor
accelerometer
zillow
firebase-cloud-messaging
react-apollo
ssis-2008
ebcdic
graphic
radius
omnipay
neoscms
hp-quality-center
ecore
fixtures
submenu
asn.1
apache-hive
web.py
transitions
userfrosting
fixture
gulp-usemin
parasoft
yield
ctags
smo
friend-function
android-datepicker
jedi-vim
opensmtpd
android-build
spring-java-config
unite.vim
stdio
launch-agent
cscore
z-order
unicorn
dotpeek
yahoo-messenger
into-outfile
dfdl
stunnel
yard
dynamics-nav-2009
gridsplitter
sqlsrv
apache-commons
acl2
window-position
tap
reagent
drilldown
custom-validators
ncbi
hashbytes
apache-wink
slab
curator
searchqueryset
fad
stackato
fast-esp
openacs
kiwi
raii
linq-to-lucene
stockquotes
interlacing
zebra-puzzle
eclipse-wtp
outlook-2003
aspnet-regiis.exe
java-service-wrapper
wexitstatus
jax-rpc
camping
generic-list
umbraco5
spaces
css-parsing
viewexpiredexception

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile