Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 04-21-2012, 07:43 AM
tinfanide tinfanide is offline Word VBA: Cannot Edit Range (Delete characters except the first in a table cell) Windows 7 64bit Word VBA: Cannot Edit Range (Delete characters except the first in a table cell) Office 2010 32bit
Expert
Word VBA: Cannot Edit Range (Delete characters except the first in a table cell)
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default Word VBA: Cannot Edit Range (Delete characters except the first in a table cell)


Views: 14 Size: 15.9 KB">CannotEditRange.zip


Code:
Sub t()
''' Retain every first character of each cell in Table 1


Dim oRange As Range

With Selection
    Set oRange = .Range
    With oRange
        .Start = .Start - 1
        .Delete ''' Run-time error 5904: Cannot edit Range
    End With
End With

End Sub
There's a table with 3 cells / rows.
Each row has a string like "abcde".
I want to delete all the characters except the first one.
I don't know why my codes above only show errors when the strings are inside a table cell. (If "abcde" is in a paragraph, it works)
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Word VBA: Cannot Edit Range (Delete characters except the first in a table cell) Set range for merged Word table cells? tinfanide Word VBA 1 02-06-2012 05:57 AM
How can I delete the content of a cell in column if the cell value is more than 1000? Learner7 Excel 2 06-27-2011 05:44 AM
Can't delete range - error 5904 expatriate Word VBA 1 06-03-2011 12:12 AM
Word VBA: Cannot Edit Range (Delete characters except the first in a table cell) Edit number of characters per page after writing whole paper dea Word 1 01-04-2011 02:24 AM
Auto-populate an MS Word table cell with text from a diff cell? dreamrthts Word Tables 0 03-20-2009 01:49 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:56 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft