Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If someone is able to help, I need a macro that will select a given range of
cells then convert them to a new name: See example If C7:C20 is = 0.1 then replace cell contents with 625 Basically, I need to replace the contents of all cells in a given range (that contain data) with a constant number like 625. If the cell is blank I want to leave it blank. -- Jake |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Adjust your range as needed.
Sub test() For Each cell In Range("A1:A5") If cell.Value < "" _ Then cell.Value = 625 Else End If Next cell End Sub HTH, Paul "JakeShipley2008" wrote in message ... If someone is able to help, I need a macro that will select a given range of cells then convert them to a new name: See example If C7:C20 is = 0.1 then replace cell contents with 625 Basically, I need to replace the contents of all cells in a given range (that contain data) with a constant number like 625. If the cell is blank I want to leave it blank. -- Jake |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you so much that worked like a charm, one last question and I should
have it. I am attaching the macro I am using, additionally I would like to do the same thing but with I would like to select more ranges and add more cell values such as the next line I would add would be for E3:E200 and then for each cell in range D7:D200 make the value 615. Hopefully this makes sense - I have to add about an additional 70 lines much like I am describing now. If you can help I would greatly appreciate it. -- Sub MoveActiveUSL() lastrow = Sheets("Specs"). _ Cells(Rows.count, "C").End(xlUp).Row Range("C" & (lastrow + 1)).Select Sheets("Data Transfer").Select Range("D3:D200").Select Selection.Copy Sheets("Specs").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False lastrow = Sheets("Specs"). _ Cells(Rows.count, "C").End(xlUp).Row Range("C" & (lastrow + 1)).Select For Each cell In Range("c7:c200") If cell.Value < "" _ Then cell.Value = 625 Else End If Next cell With ActiveSheet .DisplayPageBreaks = False StartRow = 1 EndRow = .Cells(.Rows.count, "C").End(xlUp).Row For Lrow = EndRow To StartRow Step -1 If IsError(.Cells(Lrow, "C").Value) Then 'Do nothing, This avoid a error if there is a error in the cell ElseIf .Cells(Lrow, "C").Value = "" Then .Rows(Lrow).Delete End If Next End With End Sub Jake "PCLIVE" wrote: Adjust your range as needed. Sub test() For Each cell In Range("A1:A5") If cell.Value < "" _ Then cell.Value = 625 Else End If Next cell End Sub HTH, Paul "JakeShipley2008" wrote in message ... If someone is able to help, I need a macro that will select a given range of cells then convert them to a new name: See example If C7:C20 is = 0.1 then replace cell contents with 625 Basically, I need to replace the contents of all cells in a given range (that contain data) with a constant number like 625. If the cell is blank I want to leave it blank. -- Jake |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Rename a range . | Excel Discussion (Misc queries) | |||
Copy, Paste and Rename a Range using a macro | Excel Discussion (Misc queries) | |||
Rename Several Defined Range Names with Macro | Excel Programming | |||
rename cells with a macro | Excel Programming | |||
Rename a Range, programatically? | Excel Programming |