Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Populating a cell with the current value of a variable
Hi - I'm having problems populating a cell with the current value of a
variable. Basically, I'm trying to do the following: - set the variable to the value within a specific cell - paste over a section of a the sheet which inlcudes the cell which was used to set the variable value in the steop above with blank/null cells - populate the original cell used to set the variable value with the variable value Below is the code I have written which is not working: Sub clearcontent() Dim testvalue Sheets("Frequency Input").Select range("J2").Select Set testvalue = Selection Sheets("Header").Visible = True Sheets("Header").Select range("A:G").Select Selection.Copy Sheets("Frequency Input").Select range("J:P").Select ActiveSheet.Paste range("J2").Select Selection = testvalue Sheets("Header").Select Application.CutCopyMode = False ActiveWindow.SelectedSheets.Visible = False End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Populating a cell with the current value of a variable
Sub clearcontent()
Dim testvalue testvalue = Sheets("Frequency Input").Range("J2").Value Worksheets("Header").Range("A:G").Copy Destination:= _ Worksheets("Frequency Input").Range("J:P") Range("J2").Value = testvalue Application.CutCopyMode = False End Sub -- HTH Bob Phillips "Linking to specific cells in pivot table" crosoft.com wrote in message ... Hi - I'm having problems populating a cell with the current value of a variable. Basically, I'm trying to do the following: - set the variable to the value within a specific cell - paste over a section of a the sheet which inlcudes the cell which was used to set the variable value in the steop above with blank/null cells - populate the original cell used to set the variable value with the variable value Below is the code I have written which is not working: Sub clearcontent() Dim testvalue Sheets("Frequency Input").Select range("J2").Select Set testvalue = Selection Sheets("Header").Visible = True Sheets("Header").Select range("A:G").Select Selection.Copy Sheets("Frequency Input").Select range("J:P").Select ActiveSheet.Paste range("J2").Select Selection = testvalue Sheets("Header").Select Application.CutCopyMode = False ActiveWindow.SelectedSheets.Visible = False End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
auto populating a cell based on another cell for an invoice | Excel Discussion (Misc queries) | |||
Populating Last Saved Date in Cell AND also update that same cell in Header | Excel Discussion (Misc queries) | |||
Populating a summary of variable size. | Excel Discussion (Misc queries) | |||
variable = current cell in VB | Excel Programming | |||
Syntax to define a variable for current file | Excel Programming |