![]() |
|
#2
|
||||
|
||||
|
Assuming the workbook is open at the sheet you want to process then
Code:
Private Sub CommandButton2_Click()
Dim objXL As Object
Dim NumRows As Long
Dim xlsNextRow As Long
Dim xlSheet As Object
If Len(Selection) > 1 Then
Set objXL = GetObject(, "excel.application")
Set xlSheet = objXL.activesheet
xlsNextRow = xlSheet.Range("B" & xlSheet.Rows.Count).End(-4162).Row + 1
xlSheet.Cells(xlsNextRow, 2) = Selection.Text
Else
MsgBox "Nothing selected"
End If
Set objXL = Nothing
Set xlSheet = Nothing
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
| Tags |
| word to excel text |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Excel VBA macro to copy specific rows and delete it
|
pourmalla | Excel Programming | 2 | 04-02-2017 12:09 AM |
| Counting Consecutive Periods In Rows Using Numbers | Yaaseen23 | Excel | 18 | 03-24-2017 11:15 AM |
| Copy Underline text from Word and Paste into excel | rfaris | Excel Programming | 7 | 10-05-2015 05:56 AM |
Is it possible to copy non-contiguous rows of a Table and paste them as a separate Table in Word?
|
Joey Cheung | Word Tables | 1 | 08-12-2014 05:15 PM |
Find Results in excel copy the rows to another sheet
|
khalidfazeli | Excel | 2 | 02-06-2013 09:38 AM |