![]() |
How to run this macro
I am trying to run this macro to take the value in cells C1 & C2 and
write them in the cells below. When I run this macro nothing happens. What am i missing? Sub LegUpdate() ' Dim ORG As String Dim DES As String ORG = c1 DES = c2 B5 = ORG H5 = ORG N5 = ORG B29 = ORG H29 = ORG N29 = ORG B6 = DES H6 = DES N6 = DES B28 = DES H28 = DES N26 = DES ' ' End Sub |
How to run this macro
What are c1 and c2... cell addresses? If so, try this...
ORG = Range("C1").Value DES = Range("C2").Value -- Rick (MVP - Excel) "Paul Lambson" wrote in message ... I am trying to run this macro to take the value in cells C1 & C2 and write them in the cells below. When I run this macro nothing happens. What am i missing? Sub LegUpdate() ' Dim ORG As String Dim DES As String ORG = c1 DES = c2 B5 = ORG H5 = ORG N5 = ORG B29 = ORG H29 = ORG N29 = ORG B6 = DES H6 = DES N6 = DES B28 = DES H28 = DES N26 = DES ' ' End Sub |
How to run this macro
your code does not reference any worksheet / range
see if this does what you want. Sub LegUpdate() ' Dim ORG As String Dim DES As String Dim Myws As Worksheet Set Myws = Worksheets("Sheet1") '<< change as required With Myws ORG = .Range("c1").Value DES = .Range("c2").Value .Range("B5,B29,H5,H29,N5,N29") = ORG .Range("B6,B28,H6,H28,N6,N28") = DES End With End Sub -- jb "Paul Lambson" wrote: I am trying to run this macro to take the value in cells C1 & C2 and write them in the cells below. When I run this macro nothing happens. What am i missing? Sub LegUpdate() ' Dim ORG As String Dim DES As String ORG = c1 DES = c2 B5 = ORG H5 = ORG N5 = ORG B29 = ORG H29 = ORG N29 = ORG B6 = DES H6 = DES N6 = DES B28 = DES H28 = DES N26 = DES ' ' End Sub |
How to run this macro
On May 27, 2:32*pm, "Rick Rothstein"
wrote: What are c1 and c2... cell addresses? If so, try this... ORG = Range("C1").Value DES = Range("C2").Value -- Rick (MVP - Excel) "Paul Lambson" wrote in message ... I am trying to run this macro to take the value in cells C1 & C2 and write them in the cells below. When I run this macro nothing happens. What am i missing? Sub LegUpdate() ' Dim ORG As String Dim DES As String ORG = c1 DES = c2 B5 = ORG H5 = ORG N5 = ORG B29 = ORG H29 = ORG N29 = ORG B6 = DES H6 = DES N6 = DES B28 = DES H28 = DES N26 = DES ' ' End Sub- Hide quoted text - - Show quoted text - Rick has the right idea (i.e. DES = Range("C2").Value ). I would just add that to set the value you must use Range or Cells. Range("B5") = ORG also if you want to reference a specific sheet you can do that as well. Sheets("sheet_name").Range("B5") = ORG Good luck, Sam |
How to run this macro
LOL... I was concentrating so hard on the c1/c2 problem that I completely
overlooked the rest of the code's problems. Thanks for catching that. -- Rick (MVP - Excel) "Sam" wrote in message ... On May 27, 2:32 pm, "Rick Rothstein" wrote: What are c1 and c2... cell addresses? If so, try this... ORG = Range("C1").Value DES = Range("C2").Value -- Rick (MVP - Excel) "Paul Lambson" wrote in message ... I am trying to run this macro to take the value in cells C1 & C2 and write them in the cells below. When I run this macro nothing happens. What am i missing? Sub LegUpdate() ' Dim ORG As String Dim DES As String ORG = c1 DES = c2 B5 = ORG H5 = ORG N5 = ORG B29 = ORG H29 = ORG N29 = ORG B6 = DES H6 = DES N6 = DES B28 = DES H28 = DES N26 = DES ' ' End Sub- Hide quoted text - - Show quoted text - Rick has the right idea (i.e. DES = Range("C2").Value ). I would just add that to set the value you must use Range or Cells. Range("B5") = ORG also if you want to reference a specific sheet you can do that as well. Sheets("sheet_name").Range("B5") = ORG Good luck, Sam |
All times are GMT +1. The time now is 11:46 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com