Hey,
I'm looking to create a table with pre-determined sentences in, so that all I need to do is add a person's name in the middle cell, and hit copy on a command button, and I will have copied the multiple cells, to be able to copy as one sentence in another program elsewhere.
I have found a code that lets me use VBA macros (sorry I'm new to all this so my language may be incorrectly used here). It seems to work, and I have posted this below:
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Dim xSheet As Worksheet
Set xSheet = ActiveSheet
If xSheet.Name <> "Definitions" And xSheet.Name <> "fx" And xSheet.Name <> "Needs" Then
xSheet.Range("A1:C17 ").Copy
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End If
Application.ScreenUpdating = True
End Sub
It's handy as it lets me just change the cell range and I am good to go.
How do I stop it from copying the formatting? If I made a range of say A1:C1, I find that what ever is written into B1 has large gaps between it, where as I want it to read as a sentence with no large gaps, just one line. (cells A1 and C1 will have fixed text in them that I plan to lock, so that all I need to do is add a name into B1 and hit the command button to copy everything as one sentence. This is to save me writing out the same sentence for different people over and over again).
Can anyone help? It's not a massive issue but I'm trying to fine tune what I'm looking for so that it doesn't have big gaps. Just everything as one text.
Thanks.
Lime
I'm looking to create a table with pre-determined sentences in, so that all I need to do is add a person's name in the middle cell, and hit copy on a command button, and I will have copied the multiple cells, to be able to copy as one sentence in another program elsewhere.
I have found a code that lets me use VBA macros (sorry I'm new to all this so my language may be incorrectly used here). It seems to work, and I have posted this below:
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Dim xSheet As Worksheet
Set xSheet = ActiveSheet
If xSheet.Name <> "Definitions" And xSheet.Name <> "fx" And xSheet.Name <> "Needs" Then
xSheet.Range("A1:C17 ").Copy
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End If
Application.ScreenUpdating = True
End Sub
It's handy as it lets me just change the cell range and I am good to go.
How do I stop it from copying the formatting? If I made a range of say A1:C1, I find that what ever is written into B1 has large gaps between it, where as I want it to read as a sentence with no large gaps, just one line. (cells A1 and C1 will have fixed text in them that I plan to lock, so that all I need to do is add a name into B1 and hit the command button to copy everything as one sentence. This is to save me writing out the same sentence for different people over and over again).
Can anyone help? It's not a massive issue but I'm trying to fine tune what I'm looking for so that it doesn't have big gaps. Just everything as one text.
Thanks.
Lime