![]() |
Home Work Help Excel VBA
I am not sure if anyone can help quick enough, but I need some help for
some extra credit due tomorrow morning. I do not know any thing in excel vba so if you can dumb it down some that would be great. Here is what I have to do: 1. create a variable named "OldRegion" and set it to cell c2 2. create a variable named "NewRegion" and set it to cell d21 3. change the text of the status bar to "retriveving data on new...," where NewRegion is the value of the NewRegion variable. 4. Replace all occurences of "OldRegion" with "NewRegion" in cell range A1:F19 5. Set the value of status bar back to false. And here is what I have, but of course it's not working Dim OldRegion OldRegion = Range("C2").Value Dim NewRegion NewRegion = Range("D21").Value Application.StatusBar = "Retrieving Data on NewRegion" Application.StatusBar = False Any help would be great and my parents would be greatfull also...Thanks |
Home Work Help Excel VBA
Looks like you pretty much have it:
Dim OldRegion OldRegion = Range("C2").Value Dim NewRegion NewRegion = Range("D21").Value Application.StatusBar = "Retrieving Data on " & NewRegion Dim cell as Range for each cell in Range("A1:F19") if lcase(cell.Value) = lcase(oldregion) then cell.Value = newregion end if Next Application.StatusBar = False If C2 and D21 contain numbers then for each cell in Range("A1:F19") if cell.Value = oldregion then cell.Value = newregion end if Next note that you will change the current value of C2 -- Regards, Tom Ogilvy You could also to the replace by using he replace command (which you can get the format for by turning on the macro recorder and doing it manually). -- Regards, Tom Ogilvy "not very bright" wrote in message ups.com... I am not sure if anyone can help quick enough, but I need some help for some extra credit due tomorrow morning. I do not know any thing in excel vba so if you can dumb it down some that would be great. Here is what I have to do: 1. create a variable named "OldRegion" and set it to cell c2 2. create a variable named "NewRegion" and set it to cell d21 3. change the text of the status bar to "retriveving data on new...," where NewRegion is the value of the NewRegion variable. 4. Replace all occurences of "OldRegion" with "NewRegion" in cell range A1:F19 5. Set the value of status bar back to false. And here is what I have, but of course it's not working Dim OldRegion OldRegion = Range("C2").Value Dim NewRegion NewRegion = Range("D21").Value Application.StatusBar = "Retrieving Data on NewRegion" Application.StatusBar = False Any help would be great and my parents would be greatfull also...Thanks |
Home Work Help Excel VBA
Thanks for the help I think I am almost there, but It is not quite
working. Maybe a little more information. Cells C2 and D21 reference a worksheet in another workbook. I should be able change the region with a drop down box and when I am done I click on the macro button and that should bring up the data for that particular worksheet. Mark Tom Ogilvy wrote: Looks like you pretty much have it: Dim OldRegion OldRegion = Range("C2").Value Dim NewRegion NewRegion = Range("D21").Value Application.StatusBar = "Retrieving Data on " & NewRegion Dim cell as Range for each cell in Range("A1:F19") if lcase(cell.Value) = lcase(oldregion) then cell.Value = newregion end if Next Application.StatusBar = False If C2 and D21 contain numbers then for each cell in Range("A1:F19") if cell.Value = oldregion then cell.Value = newregion end if Next note that you will change the current value of C2 -- Regards, Tom Ogilvy You could also to the replace by using he replace command (which you can get the format for by turning on the macro recorder and doing it manually). -- Regards, Tom Ogilvy "not very bright" wrote in message ups.com... I am not sure if anyone can help quick enough, but I need some help for some extra credit due tomorrow morning. I do not know any thing in excel vba so if you can dumb it down some that would be great. Here is what I have to do: 1. create a variable named "OldRegion" and set it to cell c2 2. create a variable named "NewRegion" and set it to cell d21 3. change the text of the status bar to "retriveving data on new...," where NewRegion is the value of the NewRegion variable. 4. Replace all occurences of "OldRegion" with "NewRegion" in cell range A1:F19 5. Set the value of status bar back to false. And here is what I have, but of course it's not working Dim OldRegion OldRegion = Range("C2").Value Dim NewRegion NewRegion = Range("D21").Value Application.StatusBar = "Retrieving Data on NewRegion" Application.StatusBar = False Any help would be great and my parents would be greatfull also...Thanks |
Home Work Help Excel VBA
With a detailed description like that, I wouldn't know where to start.
-- Regards, Tom Ogilvy "not very bright" wrote in message ups.com... Thanks for the help I think I am almost there, but It is not quite working. Maybe a little more information. Cells C2 and D21 reference a worksheet in another workbook. I should be able change the region with a drop down box and when I am done I click on the macro button and that should bring up the data for that particular worksheet. Mark Tom Ogilvy wrote: Looks like you pretty much have it: Dim OldRegion OldRegion = Range("C2").Value Dim NewRegion NewRegion = Range("D21").Value Application.StatusBar = "Retrieving Data on " & NewRegion Dim cell as Range for each cell in Range("A1:F19") if lcase(cell.Value) = lcase(oldregion) then cell.Value = newregion end if Next Application.StatusBar = False If C2 and D21 contain numbers then for each cell in Range("A1:F19") if cell.Value = oldregion then cell.Value = newregion end if Next note that you will change the current value of C2 -- Regards, Tom Ogilvy You could also to the replace by using he replace command (which you can get the format for by turning on the macro recorder and doing it manually). -- Regards, Tom Ogilvy "not very bright" wrote in message ups.com... I am not sure if anyone can help quick enough, but I need some help for some extra credit due tomorrow morning. I do not know any thing in excel vba so if you can dumb it down some that would be great. Here is what I have to do: 1. create a variable named "OldRegion" and set it to cell c2 2. create a variable named "NewRegion" and set it to cell d21 3. change the text of the status bar to "retriveving data on new...," where NewRegion is the value of the NewRegion variable. 4. Replace all occurences of "OldRegion" with "NewRegion" in cell range A1:F19 5. Set the value of status bar back to false. And here is what I have, but of course it's not working Dim OldRegion OldRegion = Range("C2").Value Dim NewRegion NewRegion = Range("D21").Value Application.StatusBar = "Retrieving Data on NewRegion" Application.StatusBar = False Any help would be great and my parents would be greatfull also...Thanks |
Home Work Help Excel VBA
Can I email it to you?
Tom Ogilvy wrote: With a detailed description like that, I wouldn't know where to start. -- Regards, Tom Ogilvy "not very bright" wrote in message ups.com... Thanks for the help I think I am almost there, but It is not quite working. Maybe a little more information. Cells C2 and D21 reference a worksheet in another workbook. I should be able change the region with a drop down box and when I am done I click on the macro button and that should bring up the data for that particular worksheet. Mark Tom Ogilvy wrote: Looks like you pretty much have it: Dim OldRegion OldRegion = Range("C2").Value Dim NewRegion NewRegion = Range("D21").Value Application.StatusBar = "Retrieving Data on " & NewRegion Dim cell as Range for each cell in Range("A1:F19") if lcase(cell.Value) = lcase(oldregion) then cell.Value = newregion end if Next Application.StatusBar = False If C2 and D21 contain numbers then for each cell in Range("A1:F19") if cell.Value = oldregion then cell.Value = newregion end if Next note that you will change the current value of C2 -- Regards, Tom Ogilvy You could also to the replace by using he replace command (which you can get the format for by turning on the macro recorder and doing it manually). -- Regards, Tom Ogilvy "not very bright" wrote in message ups.com... I am not sure if anyone can help quick enough, but I need some help for some extra credit due tomorrow morning. I do not know any thing in excel vba so if you can dumb it down some that would be great. Here is what I have to do: 1. create a variable named "OldRegion" and set it to cell c2 2. create a variable named "NewRegion" and set it to cell d21 3. change the text of the status bar to "retriveving data on new...," where NewRegion is the value of the NewRegion variable. 4. Replace all occurences of "OldRegion" with "NewRegion" in cell range A1:F19 5. Set the value of status bar back to false. And here is what I have, but of course it's not working Dim OldRegion OldRegion = Range("C2").Value Dim NewRegion NewRegion = Range("D21").Value Application.StatusBar = "Retrieving Data on NewRegion" Application.StatusBar = False Any help would be great and my parents would be greatfull also...Thanks |
Home Work Help Excel VBA
|
All times are GMT +1. The time now is 03:05 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com