LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Naming cells using partial cell data

I get the following error when I run this code:

-----
Error:

Run-time error '1004':
That name is not valid.
-----

Code:

Dim lastrow As Long
Dim row_index As Long

For row_index = lastrow - 1 To 1 Step -1
If Left(Cells(row_index, "D").Value, 4) < Left
(Cells(row_index + 1, "D").Value, 4) Then
Cells(row_index + 1, "D").Resize(2,
1).EntireRow.Insert (xlShiftDown)
Cells(row_index + 1, "C").FormulaR1C1
= "=SUMPRODUCT(--(LEFT(R1C4:R[-1]C4,4)=LEFT(R[-1]
C4,4)),R1C3:R[-1]C3)"
Cells(row_index + 1, "C").Font.ColorIndex = 3
Cells(row_index + 1, "C").Font.Bold = True
Cells(row_index + 1, "C").Font.Size = 14
Cells(row_index + 1, "C").Name = Left(Cells
(row_index, "D").Value, 4)
End If
Next

Debugging points to the last line in the for loop (naming
the cell using the first four characters from the cell
above.)

Thanks in advance!
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Validation of partial data in a cell. Chris Excel Discussion (Misc queries) 2 August 8th 08 06:49 PM
Formula for Pulling partial data from one cell into another Jamie Excel Worksheet Functions 5 June 1st 07 12:35 AM
remove partial data from cell nanox Excel Worksheet Functions 2 April 4th 06 02:33 AM
combining partial data from 2 different cells Steven Excel Discussion (Misc queries) 1 May 28th 05 09:07 PM
Bringing partial data from one cell into another Jack Taylor Excel Worksheet Functions 2 April 5th 05 06:43 PM


All times are GMT +1. The time now is 05:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"